Split PDF by Text in JavaScript using PDF.co Web API

In this tutorial, we will show you how to Split PDF by Text from URL in JavaScript using PDF.co Web API. Below is the image of the 3-page PDF input and three individual pages of PDF output files.

Split PDF by Text Input and Output Files
Split PDF by Text Input and Output Files

Step 1: Source Code

To begin, copy the sample code here and open it in your favorite editor.

Step 2: Add API Key

In line 7, enter your PDF.co API Key. You can get it in your PDF.co dashboard.

Enter PDF.co API Key

Step 3: Fill Parameters

In line 12, add the source file link. You can enter the split search string in line 14.

Source File And Search String

Step 4: Run Code

Now, run the program to see the result.

In this tutorial, you learned how to split PDF by text from URL in JavaScript using PDF.co Web API. You also learned how to get started right away by changing only 3 lines in the sample code.