Convert Image to Searchable PDF with OCR using C#

Image to PDF OCR

Images or scanned documents can contain textual information. You can convert a scanned document or an image to a searchable PDF document with OCR programmatically using C#. So the JPG, PNG, TIFF, BMP, and other format images can be converted to searchable PDF files. Please refer to the following sections for further details:

Image to Searchable PDF Converter with OCR – C# API Installation

Aspose.OCR for .NET API can efficiently perform OCR operations on images or scanned documents. You can configure the API by downloading the DLL file from the New Releases section, or with the following NuGet installation command:

PM> Install-Package Aspose.OCR

Convert Image to Searchable PDF with OCR Programmatically using C#

You can convert a JPG, PNG, TIFF and other image formats to a searchable PDF with OCR by following the steps below:

  1. Set path for input image to recognize.
  2. Initialize AsposeOcr class instance.
  3. Recognize input image with RecognizeImage method.
  4. Save output to searchable PDF file.

The code below shows how to convert JPG, PNG, TIFF, and other image formats to searchable PDF with OCR using C#:

Convert Skewed Image to Searchable PDF with OCR Programmatically in C#

Images can sometimes be skewed for different reasons. Sometimes you may know the skew angle of the images and specify it before recognizing the image, however, you can calculate the skew angle with the API when you do not know the angle. The following steps show how to convert a skewed image to a searchable PDF file:

  1. Specify the path for input image.
  2. Initialize AsposeOcr class object.
  3. Initialize RecognitionSettings class instance.
  4. Calculate the skew angle of the image.
  5. Recognize the image and save output searchable PDF file.

The following code shows how to convert a skewed image to searchable PDF file programmatically using C#:

Below is a screenshot of the input image and output PDF file:

Image to PDF OCR

Get Free Evaluation License

You can evaluate the API without any limitations by requesting a Free Temporary License.

Conclusion

In this article, you have explored how to convert an image to a searchable PDF file programmatically using C#. A JPG, PNG, BMP, TIFF as well as a scanned document can be converted to a PDF file. You can explore other features of the API by visiting the Documentation section and feel free to contact us at Free Support Forum for any of your concerns.

See Also

Convert Image to Word Document (DOCX) with OCR using C#