L_OcrPage_SaveSvg

#include "ltocr.h"

L_LTOCR_API L_INT L_OcrPage_SaveSvg(page, fileName)

L_OcrPage page; handle to the OCR page
const L_TCHAR *fileName; output file name

Quickly saves the given page as an SVG file.

Parameter Description
page Handle to the OCR page.
fileName The name of the output file to which to save the SVG data.

Returns

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

Comments

This function will save the recognition result of this L_OcrPage as SVG. Normally, the L_OcrDocument_Save must be used to save a page (or more) to an output format. For SVG format, use this function to quickly save the page and create the output document without having to create an OCR document handle first.

This function works whether the page is part of an OCR document or is standalone.

To quickly save a givin page as an SVG stream, call L_OcrPage_SaveSvgMemory.

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.

Functions: L_OcrPage_SaveSvgMemory
Topics: Programming with LEADTOOLS OCR Module - LEAD Engine
Starting and Shutting Down the OCR Engine
Recognizing OCR Pages
Working With OCR Pages

Example

L_INT L_OcrPage_SaveSvgExample() 
{ 
   L_INT retCode = SUCCESS; 
   BITMAPHANDLE bitmap = { 0 }; 
   L_OcrEngine ocrEngine = NULL; 
   L_OcrPage ocrPage = NULL; 
 
   // Create an instance of the engine  
   retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_LEAD, &ocrEngine); 
   if (retCode != SUCCESS) 
      goto CLEANUP; 
 
   // Start the engine using default parameters  
   retCode = L_OcrEngine_Startup(ocrEngine, NULL, OCR_LEAD_RUNTIME_DIR); 
   if (retCode != SUCCESS) 
      goto CLEANUP; 
 
   // Load an image to process  
   retCode = L_LoadBitmap(MAKE_IMAGE_PATH(L_TEXT("Ocr1.tif")), &bitmap, sizeof(BITMAPHANDLE), 0, ORDER_RGB, NULL, NULL); 
   if (retCode != SUCCESS) 
      goto CLEANUP; 
 
   // Add the image to an OCR page  
   retCode = L_OcrPage_FromBitmap(ocrEngine, &ocrPage, &bitmap, L_OcrBitmapSharingMode_AutoFree, NULL, NULL); 
   if (retCode != SUCCESS) 
      goto CLEANUP; 
 
   // Transfer ownership to the OCR page  
   memset(&bitmap, 0, sizeof(bitmap)); 
 
   // Recognize it  
   retCode = L_OcrPage_Recognize(ocrPage, NULL, NULL); 
   if (retCode != SUCCESS) 
      goto CLEANUP; 
 
   // Save the results directly to a file 
   retCode = L_OcrPage_SaveSvg(ocrPage, MAKE_IMAGE_PATH(L_TEXT("Ocr1.pdf"))); 
 
CLEANUP: 
   if (bitmap.Flags.Allocated) 
      L_FreeBitmap(&bitmap); 
   if (ocrPage != NULL) 
      L_OcrPage_Destroy(ocrPage); 
   if (ocrEngine != NULL) 
      L_OcrEngine_Destroy(ocrEngine); 
 
   return retCode; 
} 
Help Version 20.0.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help