Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. BITMAPHANDLE bitmap = { 0 };
  2. L_OcrEngine ocrEngine = NULL;
  3. L_OcrPage ocrPage = NULL;
  4. L_OcrDocumentManager ocrDocumentManager = NULL;
  5. L_OcrDocument ocrDocument = NULL;
  6. L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine);
  7. L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR);
  8. L_LoadBitmap("Path to Bitmap", &bitmap, sizeof(BITMAPHANDLE), 0, ORDER_RGB, NULL, NULL);
  9. L_OcrPage_FromBitmap(ocrEngine, &ocrPage, &bitmap, L_OcrBitmapSharingMode_AutoFree, NULL, NULL);
  10. L_OcrPage_AutoZone(ocrPage, NULL, NULL);
  11. retCode = L_OcrPage_Recognize(ocrPage, NULL, NULL);
  12. L_WCHAR* text = NULL;
  13. L_UINT textLength = 0;
  14. L_OcrPage_GetText(ocrPage, -1, &text, &textLength);
  15. printf("%ls", text);
  16.  
  17. L_OcrDocument ocrDocument = NULL;
  18. L_OcrDocument_Save(ocrDocument, outputPath, DOCUMENTFORMAT_PDF, NULL, NULL);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement