Use the ImGearRecOutputManager class to produce a searchable PDF file from recognition output. Set the OutputManager.Format to "Converters.Text.PDF" prior to calling OutputManager.WriteDocument(). This converter is heavily reliant on recognized character locations.
The ImageGear Recognition API also provides specialized formats for saving PDF documents:
This specialization is suitable for indexing or archiving purposes. The original image is used as foreground with recognized text hidden behind. To use, set the OutputManager.Format to "Converters.Text.PDFImageOnText" prior calling OutputManager.WriteDocument().
This specialization is suitable for low confidence recognition output. Low confidence text is hidden behind cut-outs from the source image. To use, set the OutputManager.Format to "Converters.Text.PDFImageSubst" prior calling OutputManager.WriteDocument().
This specialization is suitable for introducing large sections of new text into the output PDF document. To use, set the OutputManager.Format to "Converters.Text.PDFEdited" prior to calling OutputManager.WriteDocument(). This format does not rely on the location of recognized characters and is suitable for when edits are made to recognition results.
Unlike exporting to other output formats that use the ImGearRecOutputManager class, exporting recognition results to a PDF can also be accomplished by using methods of the ImGearRecPage object directly.
This PDF export feature requires a license the enables the PDF format.
The ImGearRecPage.CreatePDFPage method will create a new PDF page and add the recognized text, and optionally the original input image, to it. The new page is then appended to the new or existing PDF document specified in the first parameter.
Or, if a PDF page already exists, the ImGearRecPage.PopulatePDFPage method can populate the page with the recognized data and/or original input image. Any existing content of the PDF page is preserved.
Once the recognized data has been added to the PDF document by either of the above methods, the ImGearPDFDocument.Save method can be called to write the PDF document to a file.
Both the CreatePDFPage and PopulatePDFPage methods provide an ImGearRecPDFOutputOptions class object parameter to adjust settings of the output PDF document. These settings allow the caller to show or hide the added text and/or image, indicate a compression to use for images (subject to PDF requirements), specify the PDF fonts to use for various types of text, and select whether to add text to the PDF using Windows ANSI or Unicode encoding.
If JPEG compression is used for compressing images, the compression quality can be adjusted using the global ImageGear filter parameters. The Quality and DecimationType values will be used for JPEG compression of images in the recognition PDF output. All other JPEG filter parameters are ignored. See the JPEG format topic for more information about these parameters. See the Loading topic for information on how to set global filter parameters.
The ImageGear Recognition API is able to export images to the final output document for graphics zones. Images obtained from graphic zones are stored internally, and inserted to the final output document if the output format and level allow this.
If your PDF documents require conformance to the PDF/A-1a standard, the ImGearRecPDFOutputOptions class provides a setting to make it easy to produce PDF output that can be easily and automatically converted to PDF/A later with the PDF Converter. When the ImGearRecPDFOutputOptions.OptimizeForPdfa property is set to True, Recognition will automatically produce the necessary information in the output PDF to satisfy much of the PDF/A-1a requirements. The following is an overview on what exactly will be done:
Because of the page decomposition that occurred during the Recognition process, much information about the logical structure of a page is already understood. This information allows Recognition to automatically create the logical structure and tags for the PDF content that is produced by it.
The following hierarchy is followed by Recognition to create the logical structure. Recognition will also safely handle the case where PDF content is appended to an existing PDF document that already contains a logical structure.
\Document
\OCR_Page (Part) – References the PDF page where OCR was performed.
\OCR_Zone (Div) – References all recognized text in a single OCR zone.
\OCR_Image (Figure) – References the original image used to perform OCR.
When creating Searchable Text PDFs consisting of hidden text aligned under the original image, any fonts used in this case will not be embedded because the text is not visible.
It is important to note that the PDF exported from ImageGear Recognition will not be fully PDF/A compliant. Use the ImageGear PDF Converter to automatically create a fully compliant PDF/A document. This process is demonstrated in the example below.