Page 1 of 1

pxoPageList - how to use

Posted: Sat Dec 01, 2018 2:02 am
by pmazurk
All the examples I've seen set pxoPageList to IntPtr.Zero which processes all pages. I need to examine the OCR results of a PDF one page at a time. I've tried a few ways of setting pxoPageList (such as pxoPagelist = Marshal.AllocHGlobal(Len(intPageNumber.ToString)) and pxoPagelist = Marshal.StringToHGlobalAnsi(intPageNumber.ToString) ) but I can't get any to work. When I use IntPtr.Zero, the OCR_GetText function works great. Any other setting causes an Access Violation. Would you be kind enough to share some sample VB.Net code that shows how pxoPageList should be set to process a particular page of a PDF?

Re: pxoPageList - how to use

Posted: Sat Dec 01, 2018 10:00 pm
by pmazurk
Never mind. I figured out that I needed to add

<DllImport(DLLName)>
Public Shared Function OCR_NewPagelist(ByRef pagelist As IntPtr) As Integer
End Function

<DllImport(DLLName)>
Public Shared Function OCR_AddPage(ByVal pagelist As IntPtr, ByVal PageNumber As Integer) As Integer
End Function

to PDFXOCR_Funcs. Took some effort to figure that out from the C-oriented help files, but I finally got there.

Re: pxoPageList - how to use

Posted: Thu Dec 06, 2018 1:20 pm
by Stefan - PDF-XChange
Hello pmazurk,

Glad to hear you found the solution!

Regards,
Stefan