How to edit and update a PDF file?

I am working on a web application using

One of the requirements requires me to open a given pdf that contains form fields, fill in fields such as checking checkboxes, fetching values ​​from selection inputs, and typing text into text fields, etc.

After the fields are set, I need to send it to the server and save this as a new PDF, or update the same pdf .

I don't have a submit button in the PDF itself. I need to send data to the server using a button outside the pdf file.


source to share

1 answer

When you have a file on the server and you serve it to the client, there are two instances of the file: one on the server and one on the client.

The end user can fill out the form on the client, but you need a button in the PDF if you want him to submit the data he entered to the server. This is explained here: Edit pdf embedded in browser and save PDF directly to server

Your requirement for a button outside the PDF is in most cases impossible: this requires establishing a link between the PDF viewer and the browser. This is only possible in a very specific environment: it requires the Adobe Reader plugin and will never work on a Mac. See also host callback for host

You need to revisit the requirement for a button outside the PDF! ... I was working on a similar project where a Submit button was added to a form on the fly. The button was only visible in the PDF file on the client. The client used this button to submit data.

Once the data has been submitted (see Edit the pdf embedded in the browser and save the PDF directly on the server to see what form the data can take), you can fill out the server-side form. This is explained here:

The form on your server is your template. I am guessing this pattern will be used for different people. If so, then you do not want to replace this template with a form filled by a previous user! (This code causes some serious privacy issues.)

If you really want to update a PDF that exists on the server (instead of creating a new copy), you can also read the answer to this question: How to update a PDF without creating a new PDF?



All Articles