OCR ocx only saving first two pages
Posted: Mon Sep 14, 2015 4:59 pm
We're testing the new OCR ocx and finding that only the first two pages of a document get saved, even though
it appears to process all of them.
In the free viewer, the output is always complete, just not via the ocx.
I've attached a 3-page sample document that correctly OCRs in the free viewer (PDFXchange viewer - 2.5 build 313.1)
but only produces 2 pages of output via the ocx.
Here's the basic VB6 code we're using:
Call OCR_Init(doc, PDFREGKEY, PDFDEVCODE)
res = OCR_LoadA(doc, tbInput.Text)
If IS_DS_FAILED(res) Then
MsgBox "Failed to load pdf file"
Exit Sub
End If
SetCallback doc
Dim options As PXO_Options
options.blackList = ""
options.whiteList = ""
options.ImageFlags = OCR_Image_Autorotate
options.lang = PXO_English
options.raster_dpi = 200
options.RegionMode = OCR_Auto
options.DataPath = StrConv(tbData.Text, vbUnicode)
options.accMode = 0
res = OCR_MakeSearchable(doc, options, 0)
If IS_DS_FAILED(res) Then
MsgBox "Make searchable failed " & Str(res)
Else
OCR_SaveA doc, tbOutput.Text
'MsgBox "Complete", vbInformation, "Test OCR"
ShellExecute hwnd, "open", "C:\Program Files\Tracker Software\PDF-XChange PRO 5 SDK\Examples\OcrSDKExamples\VB6 Example\" & tbOutput.Text, _
vbNullString, vbNullString, 0
End If
OCR_Delete doc
it appears to process all of them.
In the free viewer, the output is always complete, just not via the ocx.
I've attached a 3-page sample document that correctly OCRs in the free viewer (PDFXchange viewer - 2.5 build 313.1)
but only produces 2 pages of output via the ocx.
Here's the basic VB6 code we're using:
Call OCR_Init(doc, PDFREGKEY, PDFDEVCODE)
res = OCR_LoadA(doc, tbInput.Text)
If IS_DS_FAILED(res) Then
MsgBox "Failed to load pdf file"
Exit Sub
End If
SetCallback doc
Dim options As PXO_Options
options.blackList = ""
options.whiteList = ""
options.ImageFlags = OCR_Image_Autorotate
options.lang = PXO_English
options.raster_dpi = 200
options.RegionMode = OCR_Auto
options.DataPath = StrConv(tbData.Text, vbUnicode)
options.accMode = 0
res = OCR_MakeSearchable(doc, options, 0)
If IS_DS_FAILED(res) Then
MsgBox "Make searchable failed " & Str(res)
Else
OCR_SaveA doc, tbOutput.Text
'MsgBox "Complete", vbInformation, "Test OCR"
ShellExecute hwnd, "open", "C:\Program Files\Tracker Software\PDF-XChange PRO 5 SDK\Examples\OcrSDKExamples\VB6 Example\" & tbOutput.Text, _
vbNullString, vbNullString, 0
End If
OCR_Delete doc