Highlight PDF

Highlight PDF

Highlight PDF is a REST API tool that adds highlight annotations to PDF text found by search criteria or identified through supplied selections. Search for text in the same request, or use findings from Search PDF or AI Search PDF to mark only the content your application has selected. Configure annotation color, opacity, author, subject, comment, and lock state to fit the review workflow.

Key Benefits of Highlight PDF API

  • Find and highlight text in one request using exact text, custom regular expressions, or built-in pattern presets.
  • Use selected findings from Search PDF or AI Search PDF when an application needs to review matches before marking them.
  • Customize highlight color and opacity to distinguish review states, categories, or annotations in the resulting PDF.
  • Add author, subject, and comment metadata to provide context for each highlight annotation.
  • Apply highlights to selected pages when using search mode, or provide explicit selections for targeted annotation.
  • Automate the creation of review copies through a REST API that fits into existing document workflows.
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 highlight PDF text?
pdfRest offers the best solution for highlighting PDF text because it finds and marks matches in one request, supports selected search results, and lets you customize the annotations.

Search and Highlight PDF Text in One Request

Send the search criteria to Highlight PDF to find text and annotate it in the same request. The right search method depends on what you want reviewers to notice:

  • Exact text: Highlight a known term, product name, or phrase that appears throughout a PDF.
  • Built-in presets: Mark common patterns such as email addresses or dates without defining your own matching rule.
  • Custom regular expressions: Find organization-specific text, such as drawing references in the format DWG-ME-0427, even when the discipline code or drawing number varies.

For example, an engineering team can mark drawing references in a review packet so readers can spot them as they read. Use a page range to limit the search to the equipment schedule when that’s the only section the team needs to review.

Highlight Selected PDF Search Results

When a review copy needs only some of the matches, use Search PDF or AI Search PDF to find the text first. Your application can then choose which findings become annotations.

  1. Find candidate passages. Use exact text or pattern matching when the wording is predictable. Use AI Search PDF to find passages by category or description.
  2. Choose what to mark. Keep the relevant findings in your application. A procurement team, for example, might select deadlines for the initial payment while leaving references to later installments unmarked.
  3. Create the review copy. Send the selected results with the same PDF you searched. Highlight PDF uses their locations to mark the passages in the output.

Reviewers get a copy with the relevant text already marked where it appears in the document.

Customize PDF Highlight Colors and Comments

Highlight annotations can convey what a passage means for a review while leaving the text readable. Set the annotation appearance and metadata to fit the way your team reads the finished PDF:

  • Color and opacity: Distinguish types of findings with color and choose how prominently the highlights appear over the text.
  • Author and subject: Identify the source of an annotation and label the kind of review it belongs to.
  • Comments: Explain what the reviewer should look for or record why the passage was marked.

A quality team can use yellow for wording that needs approval and blue for text that needs clarification. For direct searches, submit each group in a separate request and use the first annotated output as input to the next request to keep both sets of highlights.

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.

Supply either searches to find and annotate in one call or selections to annotate previously identified matches.

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.

Highlight PDF creates text highlight annotations in a PDF. You can search for text and mark it in the same request, or annotate selected matches from a prior search. An engineering team can highlight drawing references across a review packet so reviewers see each reference in place. The annotations draw attention to the existing text. Use Redact PDF when the task calls for removing information.

Start with a known phrase and the default yellow highlight. Open the output in a PDF viewer to see the annotations, then try changing the color or adding a comment.

To test POST /pdf-with-highlighted-text 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 Highlight 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.

The operation creates a PDF with the selected highlight annotations. Use the output information to download it or pass the output resource ID to another pdfRest tool. For example, a document workflow can send that ID to Compress PDF before delivering the resulting PDF to users. You can set the output filename without its extension using output.

Highlight 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 /pdf-with-highlighted-text 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.

Use searches to tell Highlight PDF what to find. An exact phrase works for standard wording, a preset works for a common format such as a date, and a custom regex works for formats such as engineering drawing references. Include multiple definitions to mark different search terms in one PDF, or set pages to restrict the operation to a specific section.

Find candidate matches with Search PDF or AI Search PDF, then remove the matches your application does not want to highlight. Pass the retained results as selections with the same PDF used during search. For example, highlight the payment deadlines that apply to an initial invoice and leave dates for later installments unmarked. Each selection already carries its page and position.

Set pages when using direct search rules. For example, 1,4-6,10-last searches page 1, pages 4 through 6, and page 10 through the end. To limit a request that uses selections, keep matches from the pages you want before submitting the results. Each selected match has a page location, so leave pages out of the annotation request.

Set rgb_color to three RGB values and use opacity to control how strongly the highlight shows over the text. The defaults are yellow and 0.4 opacity. For example, a review workflow can use a lighter highlight over dense text or a different color to distinguish clarification requests from items that need approval. The style applies to all highlights created by that request.

Use author to identify the reviewer or team, subject to categorize the annotation, and comment to explain what needs attention. For example, set the subject to “Payment Terms” and add a note asking the reader to confirm the renewal date. These values apply to all highlights in the request and appear in viewers that display annotation details.

Set locked to true to discourage accidental changes in PDF viewers that honor the annotation flag. A user with editing access can still unlock the annotations. To merge annotation appearances into the page content for distribution, send the annotated output to Flatten Annotations. Choose the approach based on whether the highlights should stay available as separate annotations for review.

Generate candidate matches with Search PDF or AI Search PDF, then send selected findings to Highlight PDF to create a visual review copy. If reviewers decide that some of the text must be removed, send those selections to Redact PDF against the same source PDF that was searched. The highlighted copy helps reviewers identify the passages. Create the redaction preview and then apply the redactions to remove the text.

Style applies per request, so use a separate direct search request for each group of highlights. Start with the PDF, add the first group, and pass the resulting PDF resource ID into the next request. For example, annotate approval items in yellow first, then mark clarification requests in blue. If you use a selections request, generate the selections from the exact PDF you send for that operation.

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