L_OcrDocumentManager_AppendDocumentFiles

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrDocumentManager_AppendDocumentFiles(srcFileName, dstFileName)

This function appends two document files (usually have the LTD extension) which you previously created by calling L_OcrDocumentManager_CreateDocument.

Parameters

const L_TCHAR* srcFileName

Source document file name.

const L_TCHAR* dstFileName

Destination document file name.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function appends two document files (usually have the LTD extension) which you previously created by calling L_OcrDocumentManager_CreateDocument. For more information on creating OCR document files, refer to L_OcrDocumentManager_CreateDocument.

After appending the document files you can load the destination document into OCR engine again by calling L_OcrDocumentManager_CreateDocument passing L_OcrCreateDocumentOptions_LoadExisting to its 'options' parameter and the dstFileName to its 'fileName' parameter then you can save it to any of LEADTOOLS supported document formats like PDF, DOC, DOCX, TXT, and many other formats. Or you can convert the destination document directly to any of the LEADTOOLS supported document formats by calling L_DocWriterConvert.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT L_OcrDocumentManager_AppendDocumentFilesExample(const L_TCHAR* srcFileName, const L_TCHAR* dstFileName) 
{ 
   BITMAPHANDLE bitmap = { 0 }; 
   L_OcrEngine ocrEngine = NULL; 
   L_OcrDocumentManager ocrDocumentManager = NULL; 
   L_OcrDocument ocrDocument = NULL; 
 
   // Create an instance of the engine 
   L_INT retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine); 
   if(retCode == SUCCESS) 
   { 
      // Start the engine using default parameters 
      retCode = L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR); 
      if(retCode != SUCCESS) 
         return retCode; 
 
      //Get the document manager 
      retCode = L_OcrEngine_GetDocumentManager(ocrEngine, &ocrDocumentManager); 
      if(retCode != SUCCESS) 
         goto CLEANUP; 
 
      retCode = L_OcrDocumentManager_AppendDocumentFiles(srcFileName, dstFileName); 
      if(retCode != SUCCESS) 
         goto CLEANUP; 
 
      // Load the destination document file we just appended the source document file to. 
      retCode = L_OcrDocumentManager_CreateDocument(ocrDocumentManager, &ocrDocument, L_OcrCreateDocumentOptions_LoadExisting, dstFileName); 
      if(retCode != SUCCESS) 
         goto CLEANUP; 
 
      // Now save the loaded document file to PDF 
      retCode = L_OcrDocument_Save(ocrDocument, MAKE_IMAGE_PATH(L_TEXT("Ocr1.pdf")), DOCUMENTFORMAT_PDF, NULL, NULL); 
   } 
 
CLEANUP: 
   if(bitmap.Flags.Allocated) 
      L_FreeBitmap(&bitmap); 
 
   if(ocrDocument != NULL) 
      L_OcrDocument_Destroy(ocrDocument); 
 
   if(ocrEngine != NULL) 
      L_OcrEngine_Destroy(ocrEngine); 
 
   return retCode; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help