Solved

Setting PDF Form Fields Values Progammtically

Posted on 2004-10-04
11
830 Views
Last Modified: 2008-03-06
Hi,

I have a PDF Form with different type of input fields (text, checkbox etc.).

What I want is, How to assigning some value to a specific PDF Form field.
e.g. I have a PDF Form with 3 Fields say FirstName, LastName, and Gender (check box), and on the other hand I have a HTML form with the same fields, now user enter the data in HTML form and I want to set these values to PDF form fields programmatically may in VB.NET or any other commonly used languages.


Imran

P.S. I'll back tomorrow moring, about after 10 hrs of posting this question. Please post your suggestions.
0
Comment
Question by:imrancs
  • 5
  • 4
11 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12219015
The most straight forward way would be to use FDF files: You need a CGI program on your server that takes the values from the HTML form and converts them to a FDF file. If you have the full version of Acrobat, you can take your PDF form, fill in some data and then export the data as FDF file. This will give you a sample file. The FDF format is pretty simple and straight forward, so with one sample you should be able to figure out what you need to do. Once you have the FDF file, you can use a FDF merging program to merge your PDF document with the data from the FDF file. If you are not planning on doing this on a server, you can even use Acrobat to do the merging: Just open the FDF file instead of the PDF file. If the FDF file does contain a link to the PDF file, it will load this automatically.

If you want to program Acrobat, you can do this with the JavaScript/VB bridge. This allows you to use a number of Acrobat Javascript commands from a VB program. For this you would need the Acrobat SDK, because the documentation about how to do this is not available in any other form. The SDK requires an ASN membership ($195 per year or more). YOu can however still download the old (Acrobat 5) version of the SDK from Adobe's web site, which has some of the information. This would at least get you started: http://partners.adobe.com/asn/acrobat/download.jsp#fullinstall
The documents in the SDK also describe the FDF format in detail.
0
 
LVL 10

Author Comment

by:imrancs
ID: 12219105
khkremer thanks for quick and detailed response.

 - Is Acrobat 5 is free?
 - Could post some the contents of a simple FDF file?
 - What is FDF merging Program?

I have about 30+ fields in the PDF form, and i just want to fill the few fields, 2 check box and other are text fields. What I need to do in DFD file to merge only few fields?


Imran
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12219267
No, Acrobat 5 is not free. Adobe does not sell it anymore, but it was about $250. What's still free is the Acrobat 5 SDK. You need Acrobat (the full version) for it.

You can get a FDF mergeing program here: http://www.pdfeverywhere.com/pdfform.html
They are in public beta, and the download is (for now) free.

I'll be back with a simple FDF file.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12221334
Here is a sample FDF file:

%FDF-1.2
%????1 0 obj<</FDF        <<                /F(/Path/To/PdfDocument.pdf)                /ID[<b08b5ee7164611d985fd000a957e40e8><b08b5ee7164611d985fd000a957e40e8>]                /Fields[
                        <<
                                /T(CheckBox)/V/Yes
                        >>
                        <<
                                /T(Combo Box3)/V(Two)
                        >>
                        <<
                                /T(TextBox)/V(Some sample text)
                        >>
                ]
        >>
>>
endobj
trailer
<</Root 1 0 R>>
%%EOF


But, to really understand what's going on with this file, you need to play around with Acrobat and create a few of them. In general, the /T,/V pairs in the Fields array are key value pairs, with /T being the field name, and /V being the value.
0
 
LVL 10

Author Comment

by:imrancs
ID: 12245927
khkremer,

First Thaks for your help, then sorry for responding late. I was out because of sickness.


Let me try you suggestions.


Imran
0
 
LVL 10

Author Comment

by:imrancs
ID: 12246557
khkremer I have found Acroabt 4 and I am not sure about that in which version the Form is built. Can I do something with Acrobat 4?

Imran
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12246948
I don't know. Acrobat 4 did support forms, but I don't remember if it did support any automation of the forms features. AFAIK the JavaScript/VB bridge was introduced in Acrobat 5 and extended in Acrobat 6.
0
 
LVL 10

Author Comment

by:imrancs
ID: 12247111
I can fill the form in Acrobat 4 and export it to FDF and also can import data from FDF to PDF.

But now the problem is that, suppose I have a FDF file and want ot merge it with a PDF file, how I can do that.?

Its urgent please.

Imran
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 12247193
As I said, Acrobat 4 is too old. I don't remember what features it had. In newer versions of Acrobat you would use JavaScript (and potentially the VB/JavaScript bridge do perform these operations from a VB program, or any of the other automation features of Acrobat) to first load the PDF file, then load the FDF data, and as a last step flatten the document to kind of "burn in" the forms data.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remove password restriction from a PDF file. 5 134
PDF File Shrinker 10 137
stamp tool on acrobat 1 40
Free PDF readers besides Adobe Acrobat 9 40
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
*Adobe Acrobat 9 was used for this article.  Particular steps may vary depending on software versions. Adobe Acrobat has many, many variables that my be utilized to customize your forms for clarity and ease of use. The Form Editing Tool will be y…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question