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

  1. Create a Zap
  2. Google Drive App
  3. Setup Trigger
  4. Test Trigger
  5. Add PDF.co App
  6. Setup Action
  7. Test Action
  8. Test Result
  9. Add Another App
  10. Setup Custom API Call
  11. Test and Review
  12. Result
  13. Add Another App
  14. Custom API Call Configuration
  15. Test Action
  16. Test Result
  17. Output

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

Sample PDF Document
Sample PDF Document

Step 1: Create a Zap

  • To begin. First, log in to your Zapier account and click on the Create Zap button.

Step 2: Google Drive App

  • Next, select the Google Drive app and choose the New File in Folder as a trigger.

Google Drive App

Step 3: Setup Trigger

Let’s set up the trigger

  • In the Drive field, select My Google Drive.
  • In the Folder field, enter the specific folder where your file resides.

Setup Trigger

Step 4: Test Trigger

  • Click the test trigger button to see the result.

Test Trigger
Test Trigger Result

Once the test trigger was successful, you may now add another app.

Step 5: Add PDF.co App

  • Select the PDF.co app and choose the Custom API Call for the action.

Add PDF.co App

Step 6: Setup Action

Let’s set up the action

  • For the PDF.co API Endpoint field, select the v1/pdf/info. This endpoint will extract basic information about input PDF files, PDF file security permissions, and other information.
  • For the URL input parameter override field, select the Web Content Link from Google Drive.

Setup Action

Step 7: Test Action

  • Click the test and review button to test the action.

Test Action

Step 8: Test Result

  • Here’s the basic information that we extracted and find the number of pages from the PDF document.

Test Result

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

Step 9: Add Another App

  • Select the PDF.co app and choose the Custom API Call for the action.

Add Another App

Step 10: Setup Custom API Call

Let’s set up the Custom API Call configuration

  • For the PDF.co API Endpoint field, click on Custom, and type 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 URL input parameter override field, select the Web Content Link from Google Drive.

Setup Custom API Call

Step 11: Test and Review

  • Click the test and review button to see the result.

Test and Review

Step 12: Result

  • Here’s the result for converting the page into simple text and finding the empty page.

Result

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

Step 13: Add Another App

  • Search and select the PDF.co app. Then, choose the Custom API Call to do the action.

Add Another App

Step 14: Custom API Call Configuration

Let’s set up the Custom API Call configuration

  • For the PDF.co API Endpoint field, click on Custom, and type v1//pdf/edit/delete-pages. This endpoint will delete the empty page from the PDF document.
  • For the URL input parameter override field, select the Web Content Link from Google Drive.
  • For the Input JSON field, add the JSON code as input parameters.


{
"pages":"1",
"name":"result.pdf",
"async":"false"
}

Custom API Call Configuration

Step 15: Test Action

  • Now, click the test and review buttons to test the action.

Test Action

Step 16: Test Result

  • Once the test was successful, copy the URL and paste it into your browser to view the output.

Test Result

Step 17: 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 Zapier. You learned how to use the v1/pdf/info endpoint to find a number of pages in the document. You also learned how to use the v1/pdf/convert/to/text-simple to convert every page into simple text and check if the returned text is empty or not.

Related Pages:

Related Samples: