Removing JavaScript from PDFs

Andrew Sompels
Andrew Sompels
  • Updated

JavaScript in PDFs can lead to compatibility problems with OnBoard, potentially causing book build failures.

Additionally, JavaScript in PDFs poses security risks by executing malicious code and may compromise user privacy.

Removing JavaScript from PDFs ensures enhanced safety and prevents issues with OnBoard book builds. 

Read below to learn how to remove JavaScript from PDFs.

Print to PDF

"Print to PDF" will create a new PDF document with the JavaScript removed. Review the instructions below to learn how to Print to PDF.

Print to PDF on a Computer: 

1. Open the original PDF on your computer.
2. Go to "Print".
3. Under Printers, select "Print to PDF."

Important Note for Mac users: You will instead have an option for "Save" or "PDF" near the the bottom of your print prompt. Click this and choose "Save as PDF."

mceclip0.png

If you're missing this option, your IT team or computer administrator may need to enable it in your system settings. 

4. Go to the bottom of that same popup, and you'll see "Orientation". Change it from "auto portrait/Landscape" to just "landscape" or just "portrait" according to how you want the document to display (This step is only necessary if there is an issue with the file orientation).
5. Press Print (you aren't actually printing, this will pull up a save screen). 
6. Once the document is saved, upload the new simplified .PDF version to OnBoard in place of the original file.

Print to PDF from a mobile device: 

Android

1. Tap Share, then choose Print.
2. Set the printer as "Save as PDF" then click the Download PDF button.
3. Choose the location to save your file, then click Save.

iOS

1. Tap the Share icon, then choose Print.
2. Open the document preview, then tap the Share icon on the preview.
3. Choose the location to save, and your document will be converted to PDF.

Important Note: Print to PDF also flattens PDFs and might cause hyperlinks contained within the document to no longer function.

JavaScript in PDFs

Disabling JavaScript in PDFs

JavaScript can be disabled in Adobe Acrobat. Turning off this setting prevents JavaScript from being added when creating PDFs in the future.

Empty JavaScript Placeholders in PDFs

Some PDFs contain empty JavaScript placeholders that are added during file generation or optimization. These placeholders do not run any code, but they can still be detected during security checks.

When this happens, OnBoard may flag the file and prevent it from uploading or building into a book.

Example Error Message

Document security vulnerabilities detected: PDF contains JavaScript that, when viewed in a browser, could execute malicious code.

How to Resolve the Issue

Reprocessing the file removes these JavaScript entries. Common options include printing the document to PDF again or optimizing the PDF to strip out JavaScript metadata.

Additional Resources

For more information, review Adobe’s documentation on JavaScript in PDFs and its impact on security, or search Adobe’s Help Center for related articles.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.