During its lifetime, the OCR engine will require the use of a Leadtools.Codecs.RasterCodecs object to load input raster images and a Leadtools.Forms.DocumentWriters.DocumentWriter object to create output documents.
Initially, you can pass a Leadtools.Codecs.RasterCodecs and/or Leadtools.Forms.DocumentWriters.DocumentWriter instances to the IOcrEngineStartup method. This is considered the template for any subsequent Leadtools.Codecs.RasterCodecs and Leadtools.Forms.DocumentWriters.DocumentWriter instances that will be created the engine for the various operations as described below.
If you pass a null reference (Nothing in Visual Basic) as the Leadtools.Codecs.RasterCodecs object to IOcrEngineStartup, the OCR engine will create a Leadtools.Codecs.RasterCodecs object during the initialization process that you can access later through IOcrEngine.RasterCodecsInstance. When the OCR engine creates this instance, it changes the following from their default values:
rasterCodecsInstance.Options.RasterizeDocument.Load.Enabled = true rasterCodecsInstance.Options.RasterizeDocument.Load.XResolution = 300 rasterCodecsInstance.Options.RasterizeDocument.Load.YResolution = 300 rasterCodecsInstance.Options.Pdf.Load.DisplayDepth = 0
These values are changed from their default values to enable loading document file formats such as PDF, XPS, DOC DOCX, XLS, XLSX and HTML that do not contain physical size at a resolution suitable for recognition. For more information, refer to CodecsRasterizeDocumentLoadOptions.Enabled, CodecsRasterizeDocumentLoadOptions.XResolution, CodecsRasterizeDocumentLoadOptions.YResolution and CodecsPdfLoadOptions.DisplayDepth.
If you pass your own Leadtools.Codecs.RasterCodecs object to IOcrEngineStartup, it is recommended you set the same parameters as above if your application will require loading of such document formats.
If you pass a null reference (Nothing in Visual Basic) as the Leadtools.Forms.DocumentWriters.DocumentWriter object to IOcrEngineStartup, the OCR engine will also create a Leadtools.Forms.DocumentWriters.DocumentWriter object during the initialization process that you can access later through IOcrEngine.DocumentWriterInstance. Unlike the Leadtools.Codecs.RasterCodecs instance, this initial object will have all the options set to their default values.
Since LEADTOOLS OCR engine supports multi-threaded documents, each Leadtools.Forms.Ocr.IOcrDocument created will require its own instance of Leadtools.Codecs.RasterCodecs and Leadtools.Forms.DocumentWriters.DocumentWriter to load image and create document files. These objects will be created automatically when the Leadtools.Forms.Ocr.IOcrDocument is created through IOcrDocumentManager.CreateDocument and can be accessed through IOcrDocument.RasterCodecsInstance and IOcrDocument.DocumentWriterInstance respectively.
It is highly recommended that you use these instance instead of Leadtools.Forms.Ocr.IOcrEngine instances when loading images to an Leadtools.Forms.Ocr.IOcrDocument or manually using the Leadtools.Forms.DocumentWriters.DocumentWriter instance to change options or convert LTD files especially in multi-threading situations.
Initially, these objects will contain the same options as IOcrEngine.RasterCodecsInstance and IOcrEngine.DocumentWriterInstance. The IOcrDocument.UseEngineInstanceOptions property controls whether the document must re-get the these options before usage and its default value is true to easily change Leadtools.Codecs.RasterCodecs and Leadtools.Forms.DocumentWriters.DocumentWriter options globally for all current and future Leadtools.Forms.Ocr.IOcrDocument’s.
If you have a requirement to use different options per Leadtools.Forms.Ocr.IOcrDocument in the same Leadtools.Forms.Ocr.IOcrEngine, for example, you have an Leadtools.Forms.Ocr.IOcrDocument object that will save to PDF with Image/Text option and another to save to PDF/A. Then you can set IOcrDocument.UseEngineInstanceOptions of each document to false, then change the PDF options through each document IOcrDocument.DocumentWriterInstance instead of IOcrEngine.DocumentWriterInstance.