Copy link to clipboard
Copied
I want to Export a pdf file as a flat pdf file by using JavaScript. Do you have an idea how this can be solved? Let me know, if you have different ideas or methods,
Copy link to clipboard
Copied
You can flatten all form fields and comments in a file by using the flattenPages method, like this:
this.flattenPages();
Copy link to clipboard
Copied
As noted you can flatten the PDF using JavaScript. One can then save the flattened file or use the "Export to" to create a file of the PDF in a different format.
Copy link to clipboard
Copied
Thank you guys for your feedback. The flatten function is running. Great. Can you give me a tip how can I save the pdf file under a different path and different Name? My idea is to use it in the same JavaScript after the flatten function.
Copy link to clipboard
Copied
See How to Save a PDF with Acrobat JavaScript by Thom Parker. Be sure to read through the comments.
Copy link to clipboard
Copied
Dear gkaiseril,
Thank you very much for your answer. I don't have so much experiences in using JavaScript. In read the article and all the comments for different times now. I always got the security message. What is the easiest way to save the pdf file? What is necessary to run the SaveAs command. I tried to put into the "app.priv" Parameters but it didn't work. Do you have more Information or an example?
Thank you very much. Regards,
Thorsten
Copy link to clipboard
Copied
Dear gkaiseril,
I found a solution. I created a folder level script and added the saveAs function. The function of the folder level script is used now in the action script of the button. Everything works fine now.
Thanks again for your help.
Regards and have a nice day.
Thorsten
Find more inspiration, events, and resources on the new Adobe Community
Explore Now