Solved

Setting PDF Form Fields Values Progammtically

Posted on 2004-10-04
11
824 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Getting information about Fonts being used in a PDF file A colleague of mine recently faced an issue related to the PDF file format. The PDFs were containing mission critical client information, they were successfully mailed but there was a sm…
*Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now