Convert Scanned PDF to Searchable PDF

In this demonstration, we will convert a scanned PDF to a searchable PDF in Python. We will use this /v1/pdf/make searchable endpoint to make text searchable. Here’s the GIF of sample scanned PDF and converted searchable PDF.

Sample Scanned PDF and Converted Searchable PDF
Sample Scanned PDF and Converted Searchable PDF

Step 1: Add Folder Files

First, let’s start by adding our sample scanned PDF to our Python program folder. You can download our sample PDF and Python sample code here.

Step 2: Requests Module Installation

Next, if you don’t have the requests module yet, type in python -m pip install requests in your command line and it will install the requests module.

Step 3: Your API Key

Now, open the Python sample code and proceed to line 6. Then, add your PDF.co API key inside the double quote. You can get the API key in your PDF.co dashboard.

PDF.co API Key

Step 4: Source File and PDF File Name

In lines 12 and 20, enter the source file PDF and type the PDF file name.

Source File and PDF File Name

Step 5: Run Python Program

Let’s run the program and check your folder to see the result.

Run Python Program

Step 6: Sample Demo

Here’s the Python code in action.

PDF.co Web API Demo in Python
PDF.co Web API Demo in Python

In this tutorial, you learned how to convert scanned PDF to searchable PDF in Python using the PDF.co Web API. You learned how to use the PDF Make Text Searchable Web API to convert non-searchable to searchable PDF. You also learned how to install the requests module.

Make PDF Searchable – Video

Related Pages:

Related Samples: