tags:

views:

705

answers:

2

I have a PDF template file. It has a bunch of fields I need to write to using PHP. How can I easily determine the xy coordinates of a field in the file? Right now I am using xy locations but trial and error is very time consuming. Is there a better way to do this? Or even an easy way to get the xy coordinates of a point in a pdf file?

A: 

The form-filling part of your question seems related to this question. As for coords, I can't help with PHP but I have a good Perl solution for this. Here are two questions about computing X,Y coords of text. CAM::PDF has a fillformfields.pl utility that can help.

Chris Dolan
A: 

In order of my preference:

Mac: Skim - Select a Text Box. Look on the bottom right for X,Y, plus the box height & width.

Preview (included in OSX), Select a Text Box: Tools -> Show Inspector -> pick 4th tab that has a little ruler icon. This gives coordinates, but with an upper-left origin (web standard origin, but not the pdf convention)

Linux and Unix: don't know, but try... GSView xpdf evince gnome-gv

Windows: GSView is now my favorite: fast, convenient alway-on coordinate display, free

Foxit Reader, free for reading coordinates (see 'Properties' box), $100 if you want to save file revisions.

Foxit Phantom ($130) does not display coordinates.

PDF-Xchange will also do it for free, but the Y origin is upper-left, not lower-left, so you have to subtract every Y from your page height. And the coordinates have to be interpreted by reading an edge scale, which is hard to do accurately.

Adobe Acrobat - A sales and a tech support ticket I filed say that the $700 reader will do it. I haven't checked.

Randy J Parker