Convert Scanned PDF to Editable PDF using C#

This short tutorial explains how to convert scanned PDF to editable PDF using C#. It has details to set the IDE by installing the set of libraries in Aspose.Total for .NET, a list of steps, and a sample code for converting the scan PDF to editable PDF using C#. Various options will be discussed to enhance the output PDF using different API features.

Steps to Convert PDF to Searchable PDF using C#

  1. Configure Aspose.Total for using Aspose.OCR and Aspose.PDF in the application
  2. Set licenses for all the desired products and define the input scanned PDF and output PDF files
  3. Instantiate the OCR engine object and a container for the PDF OCR input
  4. Add the input scanned PDF file to the OcrInput for processing its pages
  5. Instantiate the RecognitionSettings object for setting the options to parse general document layouts
  6. Execute OCR on the input scanned PDF for creating searchable text results using the Recognize method
  7. Export the OCR result as an editable PDF with the best quality using the Save method
  8. Reopen the PDF file generated by OCR, set its metadata such as Title, Author, and Subject, and save it as the final PDF file

The above steps describe how to make PDF readable using C#. Instantiate licenses for the Aspose.PDF and Aspose.OCR, instantiate the OCR engine with the scanned PDF file, and configure the recognition settings for processing the document. Finally, run the OCR to generate a readable PDF, reload the OCR-generated PDF, set the required metadata in it, and save the final PDF.

Code to Convert Scanned PDF to Searchable PDF using C#

This code demonstrates how to convert image PDF to text PDF using C#. You may set the detection language to speed up the process, define the detection area mode, such as multi-column, table, or universal, and enable UpscaleSmallFont to detect low DPI or tiny text in the image. If the source image contains white-on-dark text, then enable the AutomaticColorInversion property, and turn on the LinesFiltration for bordered tables/forms where grid lines interfere with OCR.

This tutorial has taught us how to convert a PDF picture to a text-based PDF. To export data from a PDF form to Excel, refer to the article Export data from a PDF form to Excel using C#.

 English