L_OcrDocumentManager_AppendDocumentFiles

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrDocumentManager_AppendDocumentFiles(srcFileName, dstFileName)

const L_TCHAR* srcFileName; source document file name
const L_TCHAR* dstFileName; destination document file name

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

Parameter Description
srcFileName Source document file name.
dstFileName Destination document file name.

Returns

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

LTOCR
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
See Also
Functions: L_OcrDocumentManager_CreateDocument, L_OcrDocumentManager_AppendDocuments, L_OcrDocumentManager_GetFormatOptions, L_OcrDocumentManager_SetFormatOptions, L_OcrDocumentManager_GetFontName, L_OcrDocumentManager_SetFontName
Topics: Programming with LEADTOOLS OCR Advantage
Starting and Shutting Down the OCR Engine

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
#define OCR_ADVANTAGE_RUNTIME_DIR TEXT("C:\\LEADTOOLS 19\\Bin\\Common\\OcrAdvantageRuntime") 
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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Advantage OCR C API Help