Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.6.9
|
Leadtools.Forms.Ocr Assembly > Leadtools.Forms.Ocr Namespace > IOcrDocumentManager Interface > CreateDocument Method : CreateDocument(String,OcrCreateDocumentOptions) Method |
IOcrDocument CreateDocument( string documentFileName, OcrCreateDocumentOptions options )
'Declaration
Overloads Function CreateDocument( _ ByVal documentFileName As String, _ ByVal options As OcrCreateDocumentOptions _ ) As IOcrDocument
'Usage
Dim instance As IOcrDocumentManager Dim documentFileName As String Dim options As OcrCreateDocumentOptions Dim value As IOcrDocument value = instance.CreateDocument(documentFileName, options)
IOcrDocument CreateDocument( string documentFileName, OcrCreateDocumentOptions options )
- (nullable LTOcrDocument *)createDocument:(nullable NSString *)ocrDocumentFilePath options:(LTOcrCreateDocumentOptions)options error:(NSError **)error
public OcrDocument createDocument(String ocrDocumentFilePath, int options)
function Leadtools.Forms.Ocr.IOcrDocumentManager.CreateDocument(String,OcrCreateDocumentOptions)( documentFileName , options )
IOcrDocument^ CreateDocument( String^ documentFileName, OcrCreateDocumentOptions options )
This method can either create a file or memory-based OCR document, or load a previously created file-based document based on the values of documentFileName and options as follows:
To create a memory-based document, pass OcrCreateDocumentOptions.InMemory to options. documentFileName is not used and the engine will not use a disk file to store the document data.
To create a file-based document that will be not be re-used, pass null to documentFileName and OcrCreateDocumentOptions.AutoDeleteFile to options. In this case, the engine will create a temporary file on disk to use as the store for the document file. The file is deleted when the IOcrDocument is disposed. Note that you use your own file name in documentFileName along with OcrCreateDocumentOptions.AutoDeleteFile, the engine will overwrite this file if it exists and automatically deletes it when disposed.
To create a file-based document that will be re-used, pass a file name to documentFileName and OcrCreateDocumentOptions.None to options. In this case, the engine will overwrite this file if it exists but will not delete it when IOcrDocument is disposed.
To re-load a document that was created with the previous option, pass the same file name to documentFileName and OcrCreateDocumentOptions.LoadExisting to options. In this case, the engine will re-generate the document from data found in the file.
Use IOcrDocument.IsInMemory to test whether a document is memory or file-based and IOcrDocument.FileName to get the name of the disk-file used by a file-based document. This will be set to the same value passed to documentFileName or the name of the temp file created.
For more information on memory and file-based documents, refer to Programming with the LEADTOOLS .NET OCR.
Typical OCR operation using the IOcrEngine involves starting up and then creating an OCR document using the CreateDocument method then adding the pages into it and perform either automatic or manual zoning. Once this is done, IOcrPage.Recognize is called on each page to collect the recognition data and have it stored internally in the page. After the recognition data is collected, you use the various IOcrDocument.Save or IOcrDocument.SaveXml methods to save the document to its final format.
When you are done using the IOcrDocument object created by this method, you should dispose it as soon as possible to free its resources. Disposing an IOcrDocument object will free all the pages stored inside its IOcrDocument.Pages collection.
For an example, refer to Startup.