Extract Content
Purpose
This API allows you to extract selected types of content from a PDF into a downloadable ZIP archive or deliver the result through a callback.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL (Download) | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/extract |
| Request URL (Callback) | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/extract/callback |
Body Parameters
| Parameter | Value | Mandatory/Optional | Description |
|---|---|---|---|
| file | File or String | Mandatory | Upload the PDF file from your local drive or desktop. If the PDF file is available via a publicly accessible web URL, you can provide the URL using the same parameter. |
| input_options | { "extract_text": true, "extract_images": true, "extract_attachments": true, "extract_metadata": true, "extract_annotations": true, "extract_bookmarks": true, "extract_rich_media": true, "extract_stamps": true, "extract_vector_graphics": true } | Mandatory | Specify which content types should be extracted. At least one extraction option must be set to true. |
| password | String | Optional | If the input PDF is password protected, specify the password to unlock it. |
| callback | { "invoke_url": "<callback_url>", "timeout": 60, "retry_interval": 60, "headers": { "header_name": "header_value" }, "http_method_type": "post" } | Mandatory for callback variant | Specify the callback delivery configuration for the /callback variant. |
input_options Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| extract_text | Boolean | true, false | true |
| extract_images | Boolean | true, false | false |
| extract_attachments | Boolean | true, false | false |
| extract_metadata | Boolean | true, false | false |
| extract_annotations | Boolean | true, false | false |
| extract_bookmarks | Boolean | true, false | false |
| extract_rich_media | Boolean | true, false | false |
| extract_stamps | Boolean | true, false | false |
| extract_vector_graphics | Boolean | true, false | false |
callback parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| invoke_url | String | URL. Maximum length: 300 characters. | – |
| timeout | Integer | 10 to 120 seconds | 60 seconds |
| retry_interval | Integer | 60 to 28800 seconds | 60 seconds |
| headers | JSON Object | Maximum 10 keys. Allowed characters for keys: alphabets, numbers, hyphen, underscore, dot. Maximum key length: 100. Maximum value length: 2500. | – |
| http_method_type | String | put, post | post |
Output Details
The API always returns a ZIP archive. The exact contents of the ZIP depend on which extraction options are enabled. Every response includes an extraction_report.txt summarizing what was found and extracted.
extract_text
Extracts all visible text from the PDF pages (in reading order) using text stripping.
Output file: extracted_text.txt Format: Plain text (UTF-8). All pages are concatenated into a single file with page breaks.
extracted.zip
├── extracted_text.txt ← "Page 1 content here...\nPage 2 content here..."
└── extraction_report.txt
extract_images
Extracts all raster images embedded in page resources (photos, diagrams, logos, etc.).
Output files: page_N_image_N.{png|jpg} — one file per image, named by page number and image index. Format: The extension reflects the original embedded bitmap format. Lossless embeddings (such as flate-compressed bitmaps) are saved as .png, and lossy JPEG-compressed embeddings are saved as .jpg. You do not pass the format; it is derived from the source image so no quality is lost.
extracted.zip
├── page_1_image_1.png ← Logo from page 1 (saved as PNG)
├── page_1_image_2.jpg ← Photo from page 1 (saved as JPG)
├── page_3_image_3.png ← Diagram from page 3 (saved as PNG)
└── extraction_report.txt
extract_attachments
Extracts embedded file attachments from the parent PDF only. Two sources are supported:
- Document-level attachments — files attached to the PDF as a whole (visible in the "Attachments" panel of PDF readers).
- Page-level annotation attachments — files attached via paperclip/pin annotations on specific pages (PDAnnotationFileAttachment).
Supported attachment types: Only PDF and image formats (e.g., .pdf, .png, .jpg, .jpeg, .gif, .bmp, .tiff, .webp) are extracted. Attachments of other file types are skipped.
Note: Only attachments embedded directly in the parent PDF are extracted. Nested attachments — i.e., attachments inside an attached PDF — are not supported and will not be traversed or extracted.
Output files: Original files in attachments/ folder, preserving their original filenames. Format: The original attached files as-is (e.g., .pdf, .png, .jpg).
extracted.zip
├── attachments/
│ ├── signed_form.pdf ← Document-level PDF attachment
│ ├── scan_1.png ← Document-level image attachment
│ └── receipt.jpg ← Page-level annotation attachment
└── extraction_report.txt
extract_metadata
Extracts standard PDF document information and structural properties. The returned keys are the same set supported by the Get PDF Properties API. Refer to that reference for the authoritative key list, types, and descriptions.
Supported keys: page_count, title, author, subject, keywords, creator, producer, creation_date, modification_date, is_encrypted, pdf_version, pages (per-page dimensions array), attachment_count, attachment_names.
Output file: metadata.json Format: JSON object with string/number/boolean/array values.
{
"page_count": 42,
"title": "Annual Report 2024",
"author": "John Doe",
"subject": "Financial Summary",
"keywords": "finance, annual, report",
"creator": "Microsoft Word",
"producer": "Apache PDFBox",
"creation_date": "Wed Jan 15 10:30:00 IST 2024",
"modification_date": "Fri Mar 20 14:15:00 IST 2024",
"is_encrypted": false,
"pdf_version": 1.7,
"pages": [
{ "page_number": 1, "width": 612.0, "height": 792.0, "rotation": 0 }
],
"attachment_count": 2,
"attachment_names": ["invoice.pdf", "scan.png"]
}
extract_annotations
Extracts text annotations (comments, sticky notes, highlights with comments) and hyperlinks from each page. Only the text content is extracted — not the visual appearance of the annotation.
Output: Entries in extraction_report.txt (not a separate file). Format: Plain text lines prefixed with page number.
What gets extracted:
- Comments/Markup: Text content from sticky notes, highlight comments, underline comments, strikeout comments, and other markup annotations (excluding stamps and FreeText).
- Hyperlinks: URI values from link annotations (the URL itself, not the visible link text).
extraction_report.txt:
Page 1 Comment: Please review this section before publishing.
Page 1 Link: https://www.example.com/reference
Page 3 Comment: Data needs to be updated for Q4.
Page 5 Link: mailto:team@example.com
Note: FreeText annotations (text boxes placed directly on the page) are excluded from comment extraction. Rubber stamp annotations are handled separately by extract_stamps.
extract_bookmarks
Extracts the document's bookmark/outline tree — the navigational table of contents visible in the "Bookmarks" panel in PDF readers.
Output file: bookmarks.json Format: Structured JSON array with nested hierarchy. Each bookmark has a title, level (depth), and optional children array.
[
{
"title": "Chapter 1: Introduction",
"level": 0,
"children": [
{
"title": "1.1 Background",
"level": 1
},
{
"title": "1.2 Objectives",
"level": 1
}
]
},
{
"title": "Chapter 2: Methodology",
"level": 0
} ]
extract_rich_media
Extracts Rich Media content embedded in the PDF — typically video, audio, or other interactive content — as well as 3D model assets.
Output files: Original media files in rich_media/ folder. Format: The original embedded binary files (.mp4, .mp3, etc.) and 3D models (.u3d).
What gets extracted:
- Rich Media annotations (RichMedia subtype): Walks the RichMediaContent → Assets → Names dictionary and extracts all referenced files.
- 3D annotations (3D subtype): Extracts the 3D model stream (3DD entry) as a .u3d file.
extracted.zip
├── rich_media/
│ ├── product_demo.mp4 ← Embedded video
│ ├── 3d_model_1713264000.u3d ← 3D model asset
│ └── narration.mp3 ← Embedded audio
└── extraction_report.txt
Note: Rich Media is uncommon in most PDFs. It is primarily found in interactive PDFs generated by specialized authoring tools.
extract_stamps
Extracts rubber stamp annotations — both standard PDF stamps (e.g., "APPROVED", "DRAFT", "CONFIDENTIAL") and custom stamps with embedded images.
Output:
- Standard stamp metadata (type name, text content) → entries in extraction_report.txt.
- Custom stamp images (extracted from the annotation's appearance stream) → stamp_image_*.{png|jpg} files in the ZIP.
extraction_report.txt:
Page 1 Stamp Found
-> Standard Type: Approved
-> Text Content: Approved by Manager
Page 3 Stamp Found
-> Standard Type: Draft
-> Extracted custom stamp image: stamp_image_1713264000.png
extracted.zip
├── stamp_image_1713264000.png ← Custom stamp artwork
└── extraction_report.txt
What gets extracted:
- Standard stamp name (e.g., Approved, Draft, Confidential, Final, NotApproved, Expired, etc.)
- Text content associated with the stamp (if any)
- Custom stamp images — when a stamp uses a custom graphic (company logo, signature image, etc.), the image is extracted from the annotation's XObject resources in the appearance stream
extract_vector_graphics
Renders each page's vector-only content (shapes, lines, paths, borders, diagrams drawn with vector commands) as a PNG image at 140 DPI, excluding all text and raster images.
Output files: page_N_vectors.png — one PNG per page. Format: PNG image (RGB, 140 DPI). The rendered image shows only the vector paths/shapes — text and photos are invisible.
extracted.zip
├── page_1_vectors.png ← Only shapes/lines from page 1
├── page_2_vectors.png ← Only shapes/lines from page 2
├── page_3_vectors.png ← Only shapes/lines from page 3
└── extraction_report.txt
How it works: Uses a custom renderer (VectorOnlyRenderer) that overrides the PDF rendering pipeline to suppress showText() (ignores all text drawing) and drawImage() (ignores all raster images). Only vector drawing operations (paths, rectangles, lines, curves, fills, strokes) are rendered.
Use cases:
- Extracting diagrams, flowcharts, or technical drawings from PDFs that mix text with graphics.
- Isolating decorative borders, separator lines, or geometric shapes.
- Analyzing the visual structure/layout of a page without text interference.
Note: This is a page-level render, not individual shape extraction. Each page produces one full-page PNG. Pages with no vector content will produce a blank white image.
Output ZIP Structure (all options enabled)
When all extraction options are enabled, the output ZIP has the following structure:
extracted.zip
├── extracted_text.txt ← All text content
├── metadata.json ← Standard document metadata
├── bookmarks.json ← Bookmark hierarchy
├── extraction_report.txt ← Summary report (annotations, stamps, links, etc.)
├── page_1_image_1.png ← Extracted raster images
├── page_1_image_2.jpg
├── page_1_vectors.png ← Vector-only page renders
├── page_2_vectors.png
├── stamp_image_1713264000.png ← Custom stamp artwork
├── attachments/
│ ├── invoice_2024.pdf ← Embedded PDF attachment (parent-level only)
│ └── scan_image.png ← Embedded image attachment (parent-level only)
└── rich_media/
├── product_demo.mp4 ← Rich Media assets
└── 3d_model_1713264000.u3d ← 3D model
Notes and Limits
- The maximum file size allowed for the input PDF is 50 MB.
- The API returns a ZIP archive containing the extracted files and an extraction report.
- At least one extraction option in input_options must be set to true.
- Only attachments embedded directly in the parent PDF are extracted. Nested attachments inside attached PDFs are not supported.
- To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL
Possible Errors
Refer to the following pages for the list of possible errors for this API:
Download Variant Sample Request
Copiedcurl --location --request POST "https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/extract" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'file=@/Users/username/Documents/Original.pdf' \
--form 'password="pdf_password"' \
--form 'input_options={
"extract_text": true,
"extract_images": true,
"extract_attachments": true,
"extract_metadata": true,
"extract_annotations": true,
"extract_bookmarks": true,
"extract_rich_media": true,
"extract_stamps": true,
"extract_vector_graphics": true
}'Callback Variant Sample Request
Copiedcurl --location --request POST "https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/extract/callback" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'file=@/Users/username/Documents/Original.pdf' \
--form 'password="pdf_password"' \
--form 'input_options={
"extract_text": true,
"extract_images": true,
"extract_attachments": true,
"extract_metadata": true,
"extract_annotations": true,
"extract_bookmarks": true,
"extract_rich_media": true,
"extract_stamps": true,
"extract_vector_graphics": true
}' \
--form 'callback={"invoke_url": "https://www.example.com/v1/api/callback/savecallback", "timeout": 120, "retry_interval": 60, "http_method_type": "post"}'Download Variant Sample Response
Copied{
"status": "inprogress",
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/extract/job/e9051e30fd7f0093cba4247d1f831e03e945a127bde429ed6e9ef3a703b15a6060b830256c650cb88a3f687773c33076"
}Download Variant Success Response
Copied{
"status": "success",
"download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/extract/download/extracted_c1e9f2a4d6b8e3f5c7a9d1b3e5f7a9b1.zip",
"response_generated_time": 1780912499331
}Callback Variant Sample Response
Copied{
"status": "inprogress",
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/extract/job/1d358192770dc68d173ca34b8f7c9dcb121ad0bf3d6307b7387be79e76dacf586f9d62cd253c26020f8c3dcf79d51b6b"
}Callback Variant Success Response
Copied{
"status": "success",
"callback_response": {
"invoked_time": 1780912655806,
"http_status_code": 200,
"message": {
"download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/extract/download/extracted_c1e9f2a4d6b8e3f5c7a9d1b3e5f7a9b1.zip",
"response_generated_time": 1780912656237
}
}
}