Tutorial: Convert Documents Using AWS Lambda

With AWS Lambda, you can run code for virtually any type of application or backend service – all with zero administration. All you have to do is upload your code, and Lambda takes care of everything required to run and scale the code. You can set up triggers from other Amazon web services or call it directly from any web or mobile app.

A majority of LEADTOOLS features can be easily added to AWS Lambda. Features such as Text Recognition, Document Converting, Barcode Recognition, Image Processing, and many more are perfect fits for AWS Lambda.


This post focuses primarily on the code needed to make document-to-document conversion possible. The LEADTOOLS Document Converter component leads the market in terms of speed, accuracy, and reliability. These conversion libraries have the power to automatically OCR when needed to convert to and from more than 150 document and raster image formats.

Creating a project for AWS Lambda may take a little longer than creating a simple desktop application, but using Lambda removes the headaches associated with managing and maintaining your own server. This post only covers the basics, for more please view the full tutorial on how to convert documents using AWS Lambda.


using (var document = DocumentFactory.LoadFromStream(stream, new LoadDocumentOptions())) 
{ 
    var ext = DocumentWriter.GetFormatFileExtension(request.DocumentFormat); 
    var fileName = Path.Combine(@"/tmp", Path.ChangeExtension(Path.GetFileName(request.InputUrl), ext)); 
    var jobData = DocumentConverterJobs.CreateJobData(document, fileName, request.DocumentFormat); 
    var job = documentConverter.Jobs.CreateJob(jobData); 
    documentConverter.Jobs.RunJob(job); 
 
    if (job.Errors.Count > 0) 
        foreach (var error in job.Errors) 
            sw.WriteLine($@"Error during conversion: {error.Error.Message} {error.Error.StackTrace}");                                   
}

Try it out!

To test this for yourself, make sure to get the latest LEADTOOLS SDK evaluation for free from our site, if you have not already. This trial is good for 60 days and comes with unlimited chat and email support.

Support

Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.


Stay tuned as we’ll continue to post more tutorials that programmers can use to develop applications that directly impact data capture, recognition, exchange, and other pressing business needs.

About 

Technical Marketing Engineer

This entry was posted in Document Converter. Bookmark the permalink.

One Response to Tutorial: Convert Documents Using AWS Lambda

  1. Pingback: Dew Drop – May 29, 2020 (#3207) | Morning Dew

Leave a Reply

Your email address will not be published. Required fields are marked *