In this tutorial, we will show you how to extract an image from a PDF file using PDF.co Web API.

  1. Log in to PDF.co Account
  2. Request Tester Tools
  3. JSON Code
  4. Run Request Result
  5. Extraction Output

We have here a sample PDF and we’ll extract the image using the PDF.co PDF Extractor.

Screenshot of the Sample PDF Document
Screenshot of the Sample PDF Document

Step 1: Log in to PDF.co Account

  • To begin. First, log into your PDF.co account and click on the Request Tester menu.

Login PDF.co Account

Step 2: Request Tester Tools

Let’s set up the request tester tools.

  • In the Choose PDF.co API endpoint field, select the v1/pdf/convert/to/jpg endpoint. So, we can extract the image in a PDF.
  • For the Input parameters field, you can enter your source file with a direct link or input with a file.

Request Tester Tools

Step 3: JSON Code

  • Now, let’s input the JSON Code  {"rect": "85.2, 287.4, 178.8, 238.2"}. This format is the rectangular area value   x, y, width, height of the image. You can easily get the rectangular area of an image using the Bytescout PDF Multitool in this link.

JSON Code

Once you are done adding the JSON code, click on the Run Request button to see the result.

Step 4: Run Request Result

  • We successfully extracted the image from the PDF. Click on the resulting URL to view the output or directly download the output file.

Run Request Result

Step 5: Extraction Output

  • Here’s the extracted image from the PDF.
Extracted Image Output
Extracted Image Output

In this tutorial, you learned how to export an image from the PDF file using PDF.co Web API. You also learned how to get the specified rectangular area of an image.

Related Pages:

Related Samples: