In this tutorial, we will show you how to extract text from scanned PDF in JavaScript using PDF.co Web API. Below is the image of our sample scanned PDF and its TEXT output.

  1. Source Code
  2. Add API Key
  3. Add Source URL
  4. Destination File
  5. Demo
Sample Scanned PDF Input And Text Output
Sample Scanned PDF Input and Text Output

Step 1 – Source Code

First, copy the JavaScript sample code here and open it in your favorite editor.

Step 2 – Add API Key

Next, go to line 21 and add your PDF.co API Key. You can get it in the PDF.co dashboard here.

Add PDF.co API Key

Step 3 – Add Source URL

Then, add the scanned PDF URL in line 26.

Source PDF URL

Step 4 – Destination File

Finally, add the output file destination in line 32.

Output File Destination

Step 5 – Demo

Here’s a quick demo to see PDF to Text Web API in action.

PDF To Text Web API Demo
PDF to Text Web API Demo

In this tutorial, you learned how to extract text from scanned PDF in JavaScript using PDF.co Web API. You learned how to change the important parameters to get started quickly. You also got a glimpse of how the PDF.co PDF to Text Web API works.