Finding controls in pdf (and other forms)

4 posts in this topic

ptroy 0

I would like to write a program to take tagged data in a file and to then post it into the fields of a pdf files, as well as into fields of other windows programs. To test the concept of using autoit, I created a pdf form in libreoffice writer and then tried unsuccessfully to use Au3Info.exe (both the 32 bit version and the 64 bit version at different times) to find the two text fields I created in the form. I thought however that this was what Au3Info.exe was supposed to do. I did turn the freeze option off. FYI, I cannot count on the position of text fields not changing so I do not wish to use x and y coordinates - I would prefer to use the field name or at least the field type. I have tried reading through the documentation and I thought I was using Au3Info.exe correctly. I also tried the sample program I found on the forum (see below) to list all the controls in the windows but it does not seem to be finding my text fields.

Am I using the correct programs (correctly), and if not, is there another approach I should be using?

Share this post

Link to post

Share on other sites

orbs 136

many applications have a custom interface with non-standard controls. you then need to either write your own interface, or utilize an existing means of control. for PDF forms it's actually easier than it may sound - the paid full product (Adobe Acrobat) supports COM, and the free reader (Adobe Reader) can be manipulated by pdftk (a free command-line tool). have a look at the last post in this topic:

P.S. when you post code to the forum, use the code tags - the < > button at the toolbar. other than that, congrats on a well written first post.

EDIT: here is a nice explanation about how to prepare a simple text file with data fields and values, to be used by pdftk. this is a fdf file, i made up this example:

i used it on your test form - the form was filled, but i got an error from your form saying it cannot find the font "LiberationSans". i did not investigate further, i imagine that when you create a PDF form you should pay attention to using only commonly-used fonts.

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."