Tim Liberty
Tim Liberty

Reputation: 2129

Save PDF to server instead of on client machine

I have a URL http://test.com/test.pdf this link opens the PDF in browser fine. Now I have a form inside this PDF like first name, last name etc.

The user fills in this form and I want to upload it to server. The Save button inside PDF would save the file locally. Instead I need a separate Save button that can convert the PDF and it's data to byte array and submit to my server.

Is this possible?

Upvotes: 0

Views: 526

Answers (1)

joelgeraci
joelgeraci

Reputation: 4917

Unless you limit which PDF viewers can be used, you won't be able to do this. Most modern browsers will display the PDF with their built-in viewer but most of them can't deal with forms and when they do, they get it wrong. However, if you can force the PDF to download and open in Adobe Reader, you can add a button to the PDF that will submit the entire filled form to your server as the body of an HTTP post (not a file in a multi-part form submission). When creating the submit button, use a fully qualified URL to your script that saves the file to your server. It's super easy.

Upvotes: 1

Related Questions