Reading text
gamblor999 opened this issue · comments
Hi @paulocoutinhox ,
On your wasm example i have added the following to the intializefpdf
FPDF.Text_GetText = Module.cwrap('FPDFText_GetText', 'number', ['number', 'number', 'number', 'number']);
FPDF.Text_CountChars = Module.cwrap('FPDFText_CountChars', 'number', ['number']);
Text_CountChars & Text_GetText always returns 0 even for pages that have plenty of text. In your compiled wasm example is there a settings/flag which disables the text getting generated?
Appreciate any help with this.
Hi @gamblor999,
No, i don't select the methods. All methods are exported, as you can see here:
https://github.com/paulocoutinhox/pdfium-lib/blob/master/modules/wasm.py#L697-L726
The methods that you say is used here:
pdfium-lib/sample-apple/Sample/PDFium/PDFiumPage.m
Lines 77 to 90 in d1afeb2
You need check only if you are passing the correct parameters to FPDFText_CountChars
.
Or you test your methods creating a test method inside the custom.cpp file:
https://github.com/paulocoutinhox/pdfium-lib/blob/d1afeb21b3b414c15a8841efc38e39c11ce35517/extras/wasm/utils/custom.cpp
@paulocoutinhox thanks a lot for your detailed reply which has resolved my issue:
The IOS example uses both
FPDF_LoadPage
FPDFText_LoadPage Not used in WASM example
I needed to call FPDFText_LoadPage to be able to get FPDFText_CountChars .
Thanks again for your help.