Search PDF

Search PDF

Search PDF is a REST API tool that finds text in PDF documents using literal strings, regular expressions, and predefined pattern searches. Each match can include the text found, its page number, and its location on the page, giving your application structured results it can use for review, indexing, or a follow-up PDF operation. Search several patterns in one request and limit processing to selected pages when needed.

Key Benefits of Search PDF API

  • Find known terms with literal searches, or use a custom regular expression to match company-specific formats such as work order IDs.
  • Use predefined regex presets for common data patterns, then combine them with custom searches in the same request.
  • Receive matched text with page numbers and page coordinates so your application can present each result in context.
  • Search selected pages or ranges to focus processing on the portions of a PDF that matter to your workflow.
  • Return search results as JSON for application logic, or request a downloadable JSON output file.
  • Pass retained search results to Highlight PDF, Redact PDF, or Replace PDF Text to turn discovery into a targeted document update.
Build Your Solution

You have document processing problems, we have Solutions. Explore the many ways pdfRest can align your documents with your business objectives.

Browse all solutions
Ensure GDPR Compliance for PDF Processing with EU-Based Cloud API
Ensure GDPR Compliance for PDF Processing with EU-Based Cloud API
The pdfRest logo is added to the Microsoft Power Automate logo with a representation of a PNG to PDF conversion workflow
Integrate pdfRest with Microsoft Power Automate
The Salesforce logo with APEX programming language is connected with the pdfRest logo around a PDF toolkit icon
Integrate PDF API Tools with Salesforce Apex Code
Why is pdfRest the best API to search PDF text?
pdfRest offers the best solution for searching PDF text because it combines flexible matching rules, precise page locations, and results you can pass directly into document workflows.

Find PDF Text by Exact Match or Pattern

Search PDF gives you three ways to find text. Choose the method based on how much you know about the wording or format of what you’re looking for:

  • Exact text: Find a known value, such as a product name or a specific phrase in a contract. This works well when the same wording appears across documents.
  • Built-in presets: Find common formats such as email addresses, phone numbers, and dates without writing a pattern from scratch.
  • Custom regular expressions: Match text that follows your organization’s rules. For example, find work order IDs such as WO-AB-10482 using a pattern that describes the prefix, site code, and five-digit job number.

Combine several search definitions in one request, or limit a search to the pages that matter to your workflow.

Locate PDF Text with Page Coordinates

A search result is more useful when you can show exactly where the text appears. Search PDF returns structured JSON that your application can use to locate each occurrence:

  • Matched text shows the actual value found, even when a pattern can match many different values.
  • Page numbers tell your application which page to open or link to from a list of results.
  • Coordinates tell your viewer where to mark the match and distinguish separate occurrences on the same page.

For example, a service portal can find a part number across equipment manuals and take technicians directly to the relevant diagram or parts list. If the number appears three times on a page, the coordinates let a technician jump to each occurrence without searching the page again.

Turn PDF Search Results into Document Edits

Once you know what text appears and where, choose which matches to keep and send the selected results with the PDF you searched. The tool you call depends on what you want to do with the findings:

  • Highlight PDF marks selected text with annotations. Use it to call out references or terms that reviewers need to find.
  • Redact PDF takes selected findings as targets for removal. Use it to prepare a copy for sharing when specific sensitive text needs to be removed.
  • Replace PDF Text changes selected text in the document. Add the new wording to each selected match before sending the replacement request.

The same search results can support different tasks. For example, highlight internal references for reviewers and redact selected references in a separately prepared external copy.

Start from Code Examples
See more code examples in our GitHub repository

Need more help?

Start with a Tutorial for step-by-step guidance

Customize Your Solution

Learn about the parameters for this tool to create your custom solution.

Searches

The searches parameter accepts a nonempty array of search definitions. Each definition has a type and a value. You can mix methods in a single request.

  • literal: Use the exact wording to find, such as Inspection Required.
  • preset: Use a built-in pattern name, such as email for email addresses or date for dates.
  • regex: Supply a regular expression for a format specific to your documents. For example, WO-[A-Z]{2}-[0-9]{5} matches a work order ID such as WO-AB-10482.

In a JSON request, send the definitions as an array. In a multipart request, send the array as a JSON-encoded string in the searches field.

Each definition also accepts an optional content_scope. Use all (default) for all existing text or body to exclude detected headers and footers.

Safe & Secure

Confidently process your sensitive data with pdfRest. Our platform is built for robust, Enterprise-grade security and compliance. We meet rigorous standards for GDPR and HIPAA, and our controls are independently audited to ensure strict SOC 2 Type 2 compliance. Your data's protection is our commitment.

Frequently Asked Questions
Need more help? Contact Us or visit our documentation.

Search PDF finds specific words, phrases, and patterns in a PDF and returns the matching text and its location. A service portal can find a part number in a manual and send a technician to the right occurrence on the right page. For applications that need the full text rather than specific matches, use Extract Text to retrieve the document text.

Start with an exact phrase that appears in a sample PDF. Compare the matched text and page number with what you see in the document, then try a preset or a custom pattern.

To test POST /search-results directly, get a pdfRest API key and send a request from your HTTP client using the Api-Key header. To explore browser-based requests for supported tools, open the API Lab. The cURL example shows a complete request for Search PDF.

Upload a local PDF in the multipart file field, or pass the id of a PDF already uploaded to pdfRest. To use a JSON request body, send the resource ID together with your operation parameters. For example, you can send a PDF through Upload Files once and use its ID for multiple requests without transferring the same file each time.

Read the inline JSON for immediate use in your application, or set output_type to file if you want a downloadable JSON file. The default is inline JSON. An empty matches array and a warning mean the completed search found no matches. Your application can handle that as a valid outcome, such as showing an empty results state or skipping a downstream step.

Search PDF works with text embedded in the PDF, including a text layer produced by OCR. A page that contains only a scanned image needs a text layer before the tool can find words on it. First process the file with OCR PDF, then pass the resource ID of the OCR output. If you plan to use search selections afterward, generate them from that same OCR output.

Send an HTTP POST to /search-results with your API key, the PDF input, and the operation parameters. Start with searches for a request that defines what to find or process. Any language with an HTTP client can call the endpoint. Use the Cloud API Reference for authentication, request formats, and resource handling, then keep the API key on your server when building a browser-facing application. The pdfRest code samples on GitHub show request patterns in several languages.

Choose the method based on the text you know:

  • Literal text finds exact wording, such as a product name.
  • Built-in presets find common formats, such as dates or email addresses.
  • Custom regular expressions find patterns specific to your files, such as work order IDs that combine a site code and job number.

Include more than one definition in searches to look for multiple terms or formats in a single request.

Use pages to limit searching to individual pages or ranges. For example, 2-4,8-last searches pages 2 through 4 and page 8 through the end. If a term repeats in running headers, set content_scope to body on the search definition to search inferred body text and exclude detected headers and footers. Omit these options to search all text on all pages.

The results identify the source text and where it appears in the PDF. Page numbers let an application link to the right page, and coordinates distinguish occurrences within that page. A document viewer can use both to take a reader to the correct passage, even when the same search term appears several times. Search PDF leaves the document unchanged and provides the information needed for a separate annotation or editing request.

Use Search PDF when you know the wording or format you want to find, such as a specific clause heading or work order ID. Use AI Search PDF when you can describe what a passage means but do not know its wording, such as a clause explaining when an agreement renews. Both return locations your application can use to display matches or pass them to another tool.

Search the PDF first when your application needs to choose which findings reviewers should see. Keep those matches in the results and pass them as selections with the same unchanged PDF to Highlight PDF. This creates a review copy with specific occurrences marked in place. When all matches should be highlighted, Highlight PDF can find and annotate them in one call using direct search rules.

Run Search PDF with a rule for the content you intend to remove, then keep the relevant matches for redaction. Send those selections and the same PDF to Redact PDF to create a redaction preview. Apply the redactions in a separate request once the selections are final. This workflow is useful when the same identifier appears in different contexts and only some occurrences should be removed.

Filter the Search PDF results to the occurrences that should change, then add a replacement value to each retained match. Pass the selections and the same unchanged PDF to Replace PDF Text. For example, update room labels in a building guide by giving each matched label its own new name. Keep the original match text and coordinates intact so the replacement request can identify the source text.

A preset is a named pattern provided by pdfRest. For example, set the type to preset and the value to email to look for email addresses. A custom regex is a rule you supply, such as WO-[A-Z]{2}-[0-9]{5} for work order IDs like WO-AB-10482. The expression describes the prefix, letter count, and digit count, so it can match many IDs without listing them.

Generate a self-service API Key now!
Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.