How to Delete Empty Pages using PDF.co and Make

In this tutorial, we will show you how to delete empty pages using PDF.co and Make.

  1. Create a New Scenario
  2. Google Drive Module
  3. Download a File
  4. Setup Google Drive
  5. Add PDF.co Module
  6. Make an API Call
  7. Setup Make an API Call
  8. Add Another PDF.co Module
  9. Make an API Call
  10. Make an API Call Configuration
  11. Add Another Module
  12. Make an API Call
  13. Setup Make an API Call
  14. Run Scenario Result
  15. Delete Pages Output

We will use this sample PDF Document and delete the empty page.

Sample PDF Document with Empty Page
Sample PDF Document with Empty Page

Step 1: Create a New Scenario

  • To begin. First, log into your Make account and click on the Create a new scenario button.

Step 2: Google Drive Module

  • Next, search and select the Google Drive app module.

Google Drive Module

Step 3: Download a File

  • Then, choose the Download a File module.

Download a File

Step 4: Google Drive Configuration

Let’s set up the Google Drive configuration.

  • For the Enter a File ID field, choose Select from the list to see available folders from Google Drive.
  • For the Choose a Drive field, select My Drive.
  • For the File ID field, enter the specific folder where the file was stored.

Google Drive Configuration

Now, let’s add another module to get detailed information about the PDF document, its properties, and security permissions.

Step 5: Add PDF.co Module

  • Search and select the PDF.co module.

Add PDF.co Module

Step 6: Make an API Call

  • Next, select the Make an API Call module. This tool will make a call to PDF.co API.

Make an API Call

Step 7: Setup Make an API Call

Let’s set up the Make an API Call.

For the API Endpoint Path dropdown box, Type the v1/pdf/info. This endpoint will extract basic information about input PDF files, PDF file security permissions, and other information.

  • For the Input Type dropdown box, select the Upload files and inject as ‘url’ param. It will automatically input files from Google Drive.

Setup Make an API Call
Setup Make an API Call
Now, let’s add another app to check every page and see if the returned text is empty or not.

Step 8: Add Another PDF.co Module

  • Search and select the PDF.co module.

Add Another PDF.co Module

Step 9: Make an API Call

  • Next, select the Make an API Call module.

Make an API Call

Step 10: Make an API Call Configuration

  • For the API Endpoint Path dropdown box, type in /v1/pdf/convert/to/text-simple. This endpoint will convert every page into simple text, and check if the returned text is empty or not.
  • For the Input Type dropdown box, select the Upload files and inject as ‘url’ param. It will automatically input files from Google Drive.
  • Under the Body param. For Item 1, type inline for the Key and set it to true for the Value.
  • For Item 2, type async for the Key and set it to false for the Value. Set it to true, if you want to run processing asynchronously and return JobId that you may use it to check the state of the background job

Make an API Call Configuration
Make an API Call Configuration

Now, let’s add another app to delete the empty page from the PDF document.

Step 11: Add Another Module

  • Kindly search and select the PDF.co module.

Add Another Module

Step 12: Make an API Call

  • Next, select the Make an API Call module.

Make an API Call

Step 13: Setup Make an API Call

Let’s set up the Make an API Call configuration.

  • For the API Endpoint Path dropdown box, type in v1/pdf/edit/delete-pages. This endpoint will delete the empty pages from the PDF document.
  • For the Input Type dropdown box, choose the Upload files and inject as ‘url’ param. It will automatically input files from your drive.
  • In the Output File Name dropdown box, enter your desired output name.
  • Under the Body param. For Item 1, type pages for the Key and add the list of pages you want to delete for the Value.
  • For Item 2, type async for the Key and set it to false the Value. Set it to true, if you want to run processing asynchronously and return JobId that you may use it to check the state of the background job.

Setup Make an API Call
Setup Make an API Call
Setup Make an API Call

Once you set up the configuration, click on the run button to see the result.

Step 14: Run Scenario Result

  • The scenario runs successfully, kindly copy the URL and paste it into your browser to view the output.

Run Scenario Result

Step 15: Delete Pages Output

  • Great! We successfully deleted the empty page from the PDF document.
Output of PDF Delete Pages
The output of PDF Delete Pages

In this tutorial, you learned how to delete empty pages using PDF.co and Make. You learned how to use the v1/pdf/convert/to/text-simple endpoint to convert every page into simple text and check if the returned text is empty or not. You also learned how to use the v1/pdf/edit/delete-pages endpoint to delete pages from PDF documents.