In this article, we are going to see how we can perform this split PDF using the PDF splitting API by PDF.co. Here we are having the power cell program for these. So we have basically, PowerShell implementation of the split PDF, and first of all, let us see the input file, which we are going to split it up.
There are a total of four pages here. You see the first page with the image, second page with text, the third page with the references, and the fourth page with the different article sources and contributors.
Now what we are going to do here, we have the variable or the pages. So whatever the page number, we want to split it up. We’re going to have the comma-separated representation for it. For example, in the first split. If we want to page number one to two and in the second split, we want to all the pages after the third. So these kinds of pages are going to split up and we’re going to make this asynchronous job. So this is a URL of the API call, we’re going to perform for the split PDF, you see. It’s a base URL and then our URL is the PDF split.
We are going to provide the input parameters like the pages and URL of the input file. And this is an executed operation. So async, while the coding or while the looping, we’re going to provide the API keys in the headers. Once we record the response because this is the Asynch operation, we’re going to get the job ID in the response. We are fetching the job ID here and this is the placeholder for the actual response.
Initially, this URL doesn’t contain anything until the job is completed. We are going to use this URL and get the details. We are inside the infinite by loop here till the job is completed. We are checking the jobs periodically. Once it’s succeeded, you’re going to get all the files. Inside the result JSON file, we are going to perform the download one by one. Let’s see these in action. and fire up the terminal. We are having the power cell terminal here and I am simply going to execute it and here we go.
So, we got the job response, and we can see it is working. We can download the first part and the second part. We’re going to reveal in the Explorer, begin to see the files here. Here’s the first part of the two pages’ first page with the image. The second page with all the text and the second part.
You see all the references and articles sources. So it’s that easy to perform the split operation with PDF.co.
Check this PDF.co video tutorial using PDF.co Web API and follow us on YouTube!
PDF.co video tutorial
PDF.co REST Web API tutorials
- Introduction to PDF.co Web API
- How to Convert Images to PDF
- How to Convert PDF to Image
- How to Find PDF Information
- How to Make PDF Searchable
- How to Merge PDF using API
- How to Split PDF into Pages
- How to Search PDF for Text
- Add Image to Existing PDF
- Add Text to Existing PDF
- How to Convert PDF to Text
- How to Convert PDF to JSON
- How to Convert PDF to XML
- How to Convert PDF to HTML
- How to Generate BarCodes
- How to Read BarCodes