With your example application OCRDemoCsharp
Pdf contains images and text. After OCR, text in the image is searchable but text is removed.
Orignal PDF:

We are using DEMO.
If I use the same function in PDF-XChange Editor it is correct.
Code:
Code: Select all
hResult = PDFXOCR.PDFXOCR_Funcs.OCR_SetCallback(pdf, thecallback, 0);
hResult = PDFXOCR.PDFXOCR_Funcs.OCR_LoadW(pdf, m_SourceFilename);
if (PDFXOCR.PDFXOCR_Funcs.IS_DS_FAILED(hResult))
{
MessageBox.Show("Error loading file: \n" + m_SourceFilename, "OCR Library Error");
break;
};
PDFXOCR.PDFXOCR_Funcs.PXO_Options Options = new PDFXOCR.PDFXOCR_Funcs.PXO_Options();
Options.blacklist = "";
Options.whitelist = "";
Options.raster_dpi = 300;
Options.ImageFlags = (uint) PDFXOCR.PDFXOCR_Funcs.OCR_ImageProcessingFlags.OCR_Image_NoRotate;
Options.DataPath = m_Datapath;
Options.lang = m_Language;
Options.RegionMode = PDFXOCR.PDFXOCR_Funcs.OCR_RegionMode.OCR_Auto;
Options.SecondLanguage = 0;
IntPtr pxoPagelist = IntPtr.Zero; // null pointer passed to OCR_MakeSearchable() will result in all pages being OCRd.
hResult = PDFXOCR.PDFXOCR_Funcs.OCR_MakeSearchable(pdf, ref Options, pxoPagelist);