How to Remove Active Content and JavaScript from a PDF
Question details
The user needs to remove active content, such as embedded JavaScript or interactive features, from a PDF because a website is rejecting the file upload.

- Product
- Device & OS
- not provided
- Scenario
- Uploading a PDF to a website that enforces strict security policies regarding file contents.
- Observed behavior
- The website rejects the PDF upload due to the presence of active content or embedded JavaScript.
Always keep a backup copy of your original PDF file before sanitizing it, as removing active content and interactive features cannot be undone.
Sanitize the PDF Document using Adobe Acrobat
Use the built-in Sanitize Document feature in Adobe Acrobat to strip all hidden data, interactive features, and embedded JavaScript.
Sanitizing a document is the most effective way to permanently remove hidden metadata, attachments, and active content like JavaScript from professional PDF files.
Open the rejected PDF file in Adobe Acrobat.
Go to the 'Tools' menu at the top of the interface and select 'Protection'.
Click on 'Sanitize Document' to initiate the removal of hidden data and active content.
Save the sanitized PDF as a new file to preserve your original document.

Flatten the PDF using Print to PDF
Printing your document to a new PDF file is a universal way to flatten interactive elements and remove embedded JavaScript without needing advanced PDF editors.
Use WPS PDF to Flatten and Secure Your Documents
WPS Office provides powerful PDF reading and editing tools that allow you to easily flatten PDFs, ensuring your files are stripped of complex active content and ready for secure web upload.
- 1. Open the PDF in WPS Office: Launch WPS Office and open your PDF file using the built-in WPS PDF tool.
- 2. Access the Print Menu: Click on the 'Menu' button in the top left corner and select 'Print' to utilize the virtual PDF printer.
- 3. Print as a New PDF: Select 'WPS PDF' from the printer dropdown list and click 'Print'.
- 4. Save Your Document: Save the newly generated PDF. This file will now be a flattened document free of executable JavaScript.

Frequently Asked Questions
What does 'active content' in a PDF mean?
Active content refers to interactive elements within a PDF, such as embedded JavaScript, audio/video files, 3D models, or dynamic form fields. Websites often reject files with these features for strict security compliance.
Will removing JavaScript affect my PDF's text and images?
No, removing active content or flattening the PDF only disables or removes interactive features like scripts and fillable forms. The visual layout, standard text, and static images will remain completely intact.
Why do websites reject PDFs with active content?
Websites reject these files to protect their servers against malicious scripts and malware. Embedded JavaScript can potentially execute harmful code when the file is processed or opened by the server.
Can I remove active content without Adobe Acrobat?
Yes. You can use the 'Print to PDF' function available in most web browsers and free PDF viewers, including WPS Office, to create a flattened, secure version of your document that strips out hidden code.




