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

How to save pdf on server through PHP or Javascript?

Sameer_Chebbi
Registered: Jul 10 2011
Posts: 9
Answered

Hi All,
I am trying to save an editable PDF form after it has been filled up. But every time i click on the submit button, the pdf form is returned. Instead i want this file to be saved on the server.
 
How can i do this using PHP? If not PHP is there any other way out?
 
Here's my situation -
1. An editable PDF will be stored on the server which will be accessible by many clients.
2. After each client fills up the form, on clicking submit, the form needs to be saved back on to the server in two states - one editable and other non editable(layers flattened)
 
I've been partially successful in doing this using javascript but only on my machine. Because of the restriction to store the folder level trust functions in Javascripts folder of the application, I cannot replicate the same on server.
 
Any help will be greatly appreciated
 
Regards,
Sameer
 

Sameer Chebbi

My Product Information:
Acrobat Pro 10.0, Windows
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
If this is a webserver (instead of a networked storage server via Sharepoint, WebDav, etc) then you cannot "save back on to the server" - it's not how HTTP works!

Your users could save a filled-in copy of the PDF, then upload it using a server script (of the sort used to submit photos or file attachments to blogs, etc.), but that cannot be done directly from within the PDF, and your clients cannot flatten the form unless they are using Acrobat. Flattening is not available in Reader.


The correct way to do this is to submit the form to a server-side script by sending the form data as a POST action, and have a CGI script on the server which processes that data. There are many libraries for PHP, Perl, Java etc. that can take your data and create a new PDF file from it, if that is what you need, but this is NOT a job for Acrobat.


I also note your phrase "many clients". Remember you are only permitted to receive 500 responses per document, if you exceed that you will violate your license with Adobe.
Sameer_Chebbi
Registered: Jul 10 2011
Posts: 9
Thanks UVSAR for the response. I actually managed to do it using fopen and fwrite functions in PHP. Working as expected.
Regarding the 500 responses limitations, I don't quite get it. U mean to say that once uploaded on the server, this file can be accessed only 500 times and thats the end?? When and how does Adobe even know whether the limit has crossed or not?

Sameer Chebbi

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Accepted Answer
The limitation is on how many returned forms you can use if you distribute the form to more than 500 recipients. Placing the document on a web site that more than 500 people have access to in effect meets this criteria. Adobe does not and cannot directly know if you exceed this limit, but you are expected to abide by the terms of the Acrobat License Agreement.

The alternative is to Reader-enable the document using LiveCycle Reader Extensions, which is a server-based product. Several usage models are available for licensing and it can add other usage rights that Acrobat cannot. If you don't want to license this product from Adobe, Formrouter.com offers an Adobe approved service that will Reader-enable individual documents for you. Contact them for pricing, which depends on your intended usage.
Sameer_Chebbi
Registered: Jul 10 2011
Posts: 9
Thanks George :) Will look into LiveCycle Reader Extensions for sure :D

Sameer Chebbi