Question

How can I parse Pdf file with form to get fields position and page # of it on my web server? For example, there are some pdf with structure like this:

<</AcroForm 23 0 R/Metadata 2 0 R/Outlines 6 0 R/Pages 9 0 R/Type/Catalog>>
endobj
19 0 obj
<</DA(/ZaDb 0 Tf 0 g)/FT/Btn/Ff 49152/Kids[18 0 R 20 0 R]/T(Language)>>
endobj
23 0 obj
<</DA(/Helv 0 Tf 0 g )/DR<</Encoding<</PDFDocEncoding 26 0 R>>/Font<</Helv 22 0 R/ZaDb 35 0 R>>/XObject<</DSz 51 0 R>>>>/Fields[19 0 R 21 0 R 39 0 R 16 0 R 17 0 R 46 0 R 47 0 R 48 0 R]/SigFlags 1>>
endobj
25 0 obj
<</BBox[0.0 0.0 72.0 20.0]/FormType 1/Length 102/Matrix[1.0 0.0 0.0 1.0 0.0 0.0]/Resources<</Font<</Helv 22 0 R>>/ProcSet[/PDF/Text]>>/Subtype/Form/Type/XObject>>stream
1 g
0 0 72 20 re
f
/Tx BMC
q
2 1 68 18 re

How can I get field position from this code using PHP or JavaScript? Or what libs/utilities I can to try? Pdftk can't resolve my problem :( Thanks.

Était-ce utile?

La solution

Unfortunately, we can't get more information if try to scan the PDF as if it is text, coz it is much more complex, than we would imagine.

I resolve this problem uing Itext PDF library for Java. See here:

Itext get field coordinates from existing pdf

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top