Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fill PDF form with javascript

This is what I have:

  • User fills very long html form
  • User gets link to download different pdfs (this are fillable forms), links are generated using javascript
  • User clicks link, url is generated (with the data the user submitted before), data is processed in the form and fields are completed *this is done using javascript inside the form).
  • User get pdf back with fields completed.

The problem I'm running is that in some cases the data needed to send to the form is around 8000 characters, when IE only allows 2083 character in the url.

As requested by client, we need to do everything client side, that means no access to php, c#, java. Also I'm using Acrobat Pro X, to work with the pdfs.

Is there a way to submit a post request, process that request in the pdf, fill the form and return the filled form to the user? Is there another way to go around the 2083 character limit of IE?

like image 760
andrantis Avatar asked Dec 12 '25 07:12

andrantis


1 Answers

Why do you need to send 8000 characters of data to the server if you want to fill out the form on the client side? Seems like all you need to do is to establish communication between the JavaScript in the HTML page and the JavaScript in the PDF. This is explained here: PDF hostContainer callback

PS: I'm the author of the book from which this excerpt was taken: http://www.javabeat.net/2011/04/javascript-communication-between-html-and-pdf-in-itext/

like image 55
Bruno Lowagie Avatar answered Dec 13 '25 22:12

Bruno Lowagie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!