These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Dynamically Populate PDF from XFDF data

goomba441
Registered: Apr 23 2009
Posts: 3

Hello:

I have the task of writing a script system to process PDF form data. I have the system complete and working except its a little non user friendly on the back half. By this I mean my current setup is as follows:

1) User fills out form, submits it
2) Script Stores Raw XFDF data in MySQL db and emails recipient
3) Recipient gets email with link and retrieves XFDF data from database

Currently the user has to save the XFDF file that the server generated and then manually open it with Acrobat Reader. I am looking for a way to somehow make it easy so the end user just has to click on a button, and the PDF if opened up and the XFDF data fills in the PDF form ready to go.

My scripts are written in PHP. Is this something that is possible without adding any PDF libraries to the PHP build etc?

Thanks

My Product Information:
Reader 8.0
Firoz
Registered: Jan 5 2011
Posts: 6
I have exactly the same problem. Searched the web but no success so far. please let me know of any solution you find. many thanks in advance.

Firoz

maxwyss
Registered: Jul 25 2006
Posts: 255
Not working much with XFDF, but more with FDF, so I just do an analogy conclusion, and may be wrong…

You might check the MIME type setting for XFDF on your server, making the browser calling Acrobat/Reader to open the XFDF.

With FDF, this is definitely the case, and it is also possible to specify the file to retrieve when loading the FDF; and I think you do have the similar functionality using XFDF. You might check that out by manually exporting an XFDF from your form, and checking for the reference to the Base PDF.

If that fails, you might consider sending back FDF. To make work easier with FDF, you might get the FDFToolkit from Adobe.

HTH.

Max Wyss.


Firoz
Registered: Jan 5 2011
Posts: 6
Thanks Max for the reply. It looks you right however I do not have permissions from webhost to change MIME settings in Apache. This is my first website, so don't know much. Is there any way out or I will have to dump xfdf in favour of pure HTML form ? will appreciate help.

Firoz

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You need to provide the PDF location within the XFDF or FDF file and then pass the link to the XFDF or FDF file to the user. The XFDF or FDF file will open the associated PDF file and fill in the form fields. The PDF file adress is a value within ght XFDF or FDF. How to populate a PDF file's form with data from a web server by Gordon Kent.http://www.planetpdf.com/developer/article.asp?ContentID=6492

George Kaiser

maxwyss
Registered: Jul 25 2006
Posts: 255
Follow George Kaiser's advice.

Concerning the MIME Types, find out to what it is set now. It should be

application/vnd.adobe.xfdf

If it is wrong, have the web host provider fix it.




Firoz
Registered: Jan 5 2011
Posts: 6
Many thanks to both George and Max. I used the following
header('Content-Type: application/vnd.adobe.xfdf');
header('Location: MyXFDFfile.xfdf');
It simply displays the contents of MyXFDFfile.xfdf file and does not pick up the .pdf file as specified within .xfdf file.

Here are those two lines from my XFDF file:

xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"
f href="http://www.mywebsite.com/templatefolder/template.pdf"

URL: http://www.mywebsite.com/MyXFDFfile.xfdf
direct from my broser also gives the same result. Help please !!
Is it something to do with Apache version of my webhost which is 1.3.

On my own Apache 2.0 setup as localhost on my PC it all work fine. will appreciate any help or pointers to where I can get it. Thanks a ton!

Firoz

Firoz
Registered: Jan 5 2011
Posts: 6
Many many Thanks Max Wyss.

Problem solved. It was indeed MIME type from Server. I set it to application/vnd.adobe.xfdf and it worked. I verified it at my localhost but not sure if my web host will agree to provide it.

Firoz

maxwyss
Registered: Jul 25 2006
Posts: 255
Thanks for the flowers, Firoz.

They better change it, because the current situation is simply a bug. Otherwise, rethink your provider…

Max Wyss.


Firoz
Registered: Jan 5 2011
Posts: 6
Hi all, my web host refused to support MIME type application/vnd.adobe.xfdf.
Is there any other way to populate .pdf form from .xfdf file ? I have been trying the following without success:

header("Content-type: application/vnd.adobe.xfdf");
header("Expires: 0");
header('Content-disposition: inline; filename="MyFileName.xfdf"');
header("Content-Transfer-Encoding: binary\n");
readfile("xfdfFile.xfdf");

Will appreciate any help in pointing out what I am doing wrong.

Firoz

awolfe76
Registered: Feb 1 2011
Posts: 1
Hey Firoz.
I am attempting something very similar to you. But very simply, I have a link to an xfdf file like -
testlinkI saw that you said you got this to work locally with the mime type 'application/vnd.adobe.xfdf' set.

I have that set properly, but still am only able to get the xfdf content to render to the screen. Is there something else that needs done to force Adobe Reader to open.

Thanks.
mike.f
Registered: Feb 5 2011
Posts: 1
Have had similar issues. Thanks for the info.

http://www.magneticperprtualenergy.com

Firoz
Registered: Jan 5 2011
Posts: 6
Hi Awolfe76,

You need to add the following MIME type for Apache in mime.type
application/vnd.adobe.xfdf

OR, do AddType application/vnd.adobe.xfdf in .htaccess.

Good Luck

Firoz