Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setting PDF Form Fields Values Progammtically

Posted on 2004-10-04
11
Medium Priority
?
838 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

The ability to edit PDF documents can be useful, however it may not be a straight forward process. Many non-technical people don't realise that a PDF document is basically an image rather than a text file, even if it contains nothing but text. If…
The Adobe PDF proprietary file format is recognized as secure and formulated. But these PDF files are also prone to corruption and any external threat like virus attacks, improper storage can hit PDF file integrity.This type of damages can make cruc…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

670 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