How to Remove Script in a PDF using PDF.co Web API

To protect your privacy and keep your personal information secure, it is recommended to disable JavaScript in PDF documents. PDF files that have JavaScript embedded in them are more susceptible to unauthorized access and potential information theft. For added security, it is advisable to remove or disable JavaScript from PDF documents.

Thankfully, PDF.co Web API offers a convenient solution to remove embedded JavaScript from PDFs with ease.

PDF.co is a trusted platform with over 50,000 users and offers a low-code, REST API solution with over 3,000 integrations. In addition to JavaScript removal, PDF.co provides a range of online tools for essential PDF tasks such as splitting or merging PDFs, parsing documents, filling out PDF forms, converting HTML to PDF, extracting PDF data in various formats, PDF conversion, barcode reading, and more.

In today's tutorial, we will demonstrate how to remove JavaScript from PDF documents using the PDF.co Web API.

Getting Started

Below is our sample PDF with embedded JavaScript.

Screenshot of PDF with Embedded JavaScript
Screenshot of PDF with Embedded JavaScript

Follow these simple steps to remove embedded JavaScript from PDF documents using the PDF.co Web API:

Log in to Your PDF.co Account

First, you need to log in to your PDF.co account. Once you are logged in, navigate to the menu and click on "API Tools."

Sample Screenshot of PDF.co Dashboard
Sample Screenshot of PDF.co Dashboard

API Tools Page

After accessing the API Tools page, locate the Request Tester section and click on it.

Screenshot of API Tools Page
Screenshot of API Tools Page

Request Tester

To set up the Request Tester for PDF.co, follow these steps:

Step 1: Select Make PDF Unsearchable Endpoint

In the PDF.co API Endpoint field, search for and select /pdf/makeunsearchable and select it. This endpoint allows you to extract PDF and scanned images into CSV format, preserving the layout, columns, rows, and tables.

Step 2: Set Input Parameters

In the Input parameters field, you have two options:

  • Provide a URL link: If your PDF is hosted online, you can enter the URL of the PDF file.
  • Upload a file: If you have the PDF file saved on your device, you can upload it as the input.
Screenshot of Request Tester Page
Screenshot of Request Tester Page

Once you have finished setting up the configuration, simply click the "Run Request" button to send your request to PDF.co.

Step 3: Run Request Result

Excellent! Your request has been processed by the PDF.co API, and the resulting file has been generated. To view the output, simply click on the generated PDF file.

Screenshot of PDF.co Request Result
Screenshot of PDF.co Request Result

Generate Scanned PDF

Here is the scanned PDF that we have processed successfully to remove the embedded JavaScript. To obtain the generated scanned PDF without the embedded JavaScript, simply click on the "Download as file" option.

Screenshot of Generated Scanned PDF
Screenshot of Generated Scanned PDF

In this tutorial, you have learned how to use the PDF.co Web API to remove JavaScript from a PDF file. This means you can get rid of any JavaScript code that might be embedded in the PDF.

You have also learned how to convert a PDF that has searchable text into a PDF where the text cannot be searched. This is useful if you want to make the text in the PDF unsearchable.

By following the steps in the tutorial, you can easily remove JavaScript from PDF files and convert searchable PDFs into unsearchable ones using the PDF.co Web API.