Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 839
  • Last Modified:

Setting PDF Form Fields Values Progammtically

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
imrancs
Asked:
imrancs
  • 5
  • 4
1 Solution
 
Karl Heinz KremerCommented:
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
 
imrancsAuthor Commented:
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
 
Karl Heinz KremerCommented:
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: 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.

 
Karl Heinz KremerCommented:
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
 
imrancsAuthor Commented:
khkremer,

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


Let me try you suggestions.


Imran
0
 
imrancsAuthor Commented:
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
 
Karl Heinz KremerCommented:
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
 
imrancsAuthor Commented:
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
 
Karl Heinz KremerCommented:
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now