Free plan

Delete pages by content

Delete the pages that contain words you choose
POST
/v1/pdfs/delete-by-content

About this tool

This tool removes every page that contains certain words or phrases, such as Draft or Intentionally left blank. You can also do the opposite and keep only those pages. A page can match if it has any of your words, or only if it has all of them. The PDF must contain real text, not just a picture of text.
For example, you remove every page that says Draft from a report.

How to use it

  1. Choose this tool.
  2. Add your PDF with Upload or drag and drop.
  3. Type the words or phrases to look for.
  4. Choose whether to delete or keep the matching pages.
  5. Press Generate, then download the PDF.

What you get back

You get a new PDF with the pages removed or kept, as you chose. A report-only option just lists the matching pages.
GOOD TO KNOW
Only the text layer is searched; run a scan through the OCR tool first. A job that would leave no page is refused. Counts as one PDF operation.
TEST IT LIVE

Try Delete pages by content in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/delete-by-content
Tool ID
pdfs.delete-by-content
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/delete-by-content" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'terms=["Intentionally left blank","CONFIDENTIAL"]' \
  -F 'match=any' \
  -F 'action=delete'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.deleteByContent({
    "file": 'document.pdf',
    "terms": "[\"Intentionally left blank\",\"CONFIDENTIAL\"]",
    "match": "any",
    "action": "delete"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->deleteByContent([
    'file' => 'document.pdf',
    'terms' => '["Intentionally left blank","CONFIDENTIAL"]',
    'match' => 'any',
    'action' => 'delete',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Take out every page that contains certain words or phrases (separator sheets, "Intentionally left blank", a confidential page), or keep only those pages; any or all of the terms.

Delete pages by content accepts PDF. You can send several files in one request.

Delete pages by content is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/delete-by-content with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.