The goal of this is to simplify a process at my work. Any advice would be very much appreciated.

This is what we have been doing

Using Latex I create a pdf and send it to person 2. Person 2 emails back with details to fill in to document. I fill in document in Latex editor, create pdf and email back. Person 2 then emails pdf to a third party.

This is what I would like to be able to do

I create a pdf form in LaTex and send it to person 2. Person 2 fills in the form and saves it. Person 2 then sends a pdf file to a third party.

The Problem

Converting the document to be a form was easy enough thanks to previous questions on here. The problem is that it cannot be sent to the third party as a form. To fix this the pdf needs to be flattened and the easiest way to do this in adobe acrobat is with the below javascript.


What I would like to do with this is include it from when I create it in latex so that when the document is saved by person 2 after filling in the form that code is run. This can be done in acrobat with the set document actions.

From some other questions on here it seems that javascript can be embedded in latex made pdfs, so this should be possible right?

  • 1
    Why don't person 2 simply print the form to pdf? This will flatten it. Commented Nov 23, 2016 at 15:36
  • @UlrikeFischer Person 2 is not the most savy with computers. If they were then I would just have them fill it out in latex as it is not a complicated form. Also, we can only use Adobe Acrobat and this doesn't allow printing a pdf to pdf as other readers/editors do. Commented Nov 23, 2016 at 15:45

1 Answer 1


Add this to the document TeX source:

\pdfcatalog{/AA << % additional actions
  /WS << % "will save"
     /S/JavaScript /JS (this.flattenPages();)
  • @swoop Glad to hear this because I could not test it (for lack of A-Acrobat).
    – AlexG
    Commented Nov 23, 2016 at 15:42
  • That makes it all the more impressive! Good job! Commented Nov 23, 2016 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .