Find and Replace Text in PDF

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Finds text matches in a PDF and replaces them, optionally within the PDF's bookmark titles and comment annotations as well, and makes the modified PDF available for download.

Endpoint

OAuth Scope

ZohoWriter.pdfEditor.ALLCopied!

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://www.zohoapis.com/pdfeditor/api/v1/pdf/content/replace \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: multipart/form-data' \
  -F 'file=@file_path' \
  -F 'input_options={
  "replacements": [
    {
      "find": "Q3 Revenue",
      "replace": "Q4 Revenue"
    }
  ],
  "case_sensitive": true,
  "whole_word": false,
  "include_bookmarks": false,
  "include_comments": false
}' \
  -F 'password=SecurePass$2024'

Request Body

multipart/form-data
filebinary(Required)

The PDF to search and replace text within, uploaded directly or imported from a publicly accessible URL. The file must be no larger than 50 MB, contain no more than 400 pages, and have no page larger than 2,400 square inches. Its filename must not exceed 255 characters. Supported formats: pdf.

Example
quarterly-report.pdf
input_optionsJSON Object(Required)

Configures the find-and-replace behavior applied to the PDF.

Example
{
  "replacements": [
    {
      "find": "Q3 Revenue",
      "replace": "Q4 Revenue"
    }
  ],
  "case_sensitive": true,
  "whole_word": false,
  "include_bookmarks": false,
  "include_comments": false
}
Show Sub-Attributes
replacementsJSON Array[object](Required)

One or more find-and-replace pairs to apply to the PDF's text.

Example
[
  {
    "find": "Q3 Revenue",
    "replace": "Q4 Revenue"
  }
]
Range :[1 .. ∞][1 .. ∞]
Show Sub-Attributes
findstring(Required)

The text to search for in the PDF.

Example
Q3 Revenue
Maximum Length :10001000Copied!
replacestring(Required)

The text that replaces each match of find. If the same find value appears in more than one entry, the last matching entry's replace value is used.

Example
Q4 Revenue
Maximum Length :10001000Copied!
case_sensitiveboolean(Optional)

Whether text matching is case-sensitive.

Example
true
Default Value :truetrueCopied!
whole_wordboolean(Optional)

Restricts matches to whole-word boundaries instead of matching within larger words.

Example
false
Default Value :falsefalseCopied!
include_bookmarksboolean(Optional)

Also replaces matching text inside the PDF's bookmark titles.

Example
false
Default Value :falsefalseCopied!
include_commentsboolean(Optional)

Also replaces matching text inside comment and markup annotations.

Example
false
Default Value :falsefalseCopied!
passwordstring(Optional)

The password to unlock the source PDF, if it is password-protected. The modified PDF keeps the same password.

Example
SecurePass$2024
Maximum Length :255255Copied!

Body Parameters

Copied!
// Note: payload contains multiple type attributes

// type: file
file = quarterly-report.pdf

// type: object
input_options = {
  "replacements": [
    {
      "find": "Q3 Revenue",
      "replace": "Q4 Revenue"
    }
  ],
  "case_sensitive": true,
  "whole_word": false,
  "include_bookmarks": false,
  "include_comments": false
}

// type: string
password = SecurePass$2024
▼ Show full

Response Example

200
Copied!
  {
    "status": "inprogress",
    "status_check_url": "https://www.zohoapis.com/pdfeditor/api/v1/pdf/content/replace/job/9a3e7d1c6f4b82ea0d5c3f917b6a4d28e5c0f1a9b7d3e6c2a8f04b1d9e7c3a5f"
  }
                
▼ Show full

Rate Limits

Duration1 minute
Threshold50
Lock Period5 minutes 30 seconds
Duration1 hour
Threshold200
Lock Period15 minutes
Duration1 day
Threshold2000
Lock Period2 hours

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.