L_OcrPage_SaveSvg

Summary

Quickly saves the given page as an SVG file.

Syntax

#include "ltocr.h"

L_LTOCR_API L_INT L_OcrPage_SaveSvg(page, fileName)

Parameters

L_OcrPage page

Handle to the OCR page.

const L_TCHAR *fileName

The name of the output file to which to save the SVG data.

Returns

Value Meaning
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 given page as an SVG stream, call L_OcrPage_SaveSvgMemory.

Required DLLs and Libraries

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 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.