Free plan

Search in PDF

Find a word or phrase in a PDF and see where it appears
POST
/v1/pdfs/search

About this tool

This tool looks for a word or phrase in the text of a PDF and lists every match with its page number, a little text around it and where it sits on the page. It reads the real text of the PDF, so a scanned PDF with no text will find nothing until you read it with the scan reader tool. You can also get a copy with the matches highlighted.
For example, you search a 60-page contract for every mention of payment terms.

How to use it

  1. Choose this tool.
  2. Add your PDF.
  3. Type the word or phrase to find.
  4. Choose options such as which pages, matching upper and lower case, whole words only, and whether to get a highlighted copy.
  5. Press Generate, then read the matches or download the highlighted PDF.

What you get back

You get a list of matches with their pages, and a highlighted copy of the PDF if you asked for it. You can copy or download them.
GOOD TO KNOW
Searches the text layer. A scanned PDF has none: run OCR first (the answer says so). Counts as one file.
TEST IT LIVE

Try Search in PDF 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/search
Tool ID
pdfs.search
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/search" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'query=invoice number' \
  -F 'pages=1-3' \
  -F 'max_results=200'

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.search({
    "file": 'document.pdf',
    "query": "invoice number",
    "pages": "1-3",
    "max_results": 200
  });
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()->search([
    'file' => 'document.pdf',
    'query' => 'invoice number',
    'pages' => '1-3',
    'max_results' => 200,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Find a word or phrase in a PDF text layer and get every match with its page, a little text around it and its position on the page. Optionally return a copy with every match highlighted.

Search in PDF accepts PDF. You can send several files in one request.

Search in PDF is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/search 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.