> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdf.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create/Edit

> Comprehensive guide to PDF.co's document manipulation APIs for programmatic PDF generation, editing, and transformation. Includes endpoints for merging, splitting, text insertion, page deletion, and other document modifications with code examples.

export const CTAButton = ({href, text, download}) => {
  return <a href={href} download={download} target="_blank" rel="noopener noreferrer" className="text-[20px] font-medium p-5 bg-[#ff4848] text-white rounded-[5px] block w-fit mb-4">
      <span>{text}</span>
    </a>;
};

# [PDF Split](/api-reference/pdf-split)

## I Want to Skip PDF Merge When No Files Are Attached

You’re trying to merge PDF files from incoming records—but not every record includes attachments. When your automation tries to merge an empty list of files, it can fail or waste credits.

### Why This Happens

PDF Merge requires at least one valid file input. If no attachments are present, your merge step may return an error like: **"No valid file URLs provided."**

### How to Handle Records Without Attachments

* Use a **conditional step** before the merge action to check if attachments exist.
* Only proceed when files are present.

### Zapier Example

If you're using Zapier:

* **Trigger** – New record (e.g., from Airtable or Google Sheets)
* **Filter** – Use Filter by Zapier
  * **Set condition:** Attachment field exists or is not empty
* **Action** – Merge PDFs with PDF.co

If the filter condition isn’t met, the Zap stops before the merge step.

### Other Platforms

* **Make.com** – Use a filter or router before the merge module
* **n8n** – Use an IF node to check if files exist
* **Custom API** – Add a simple if condition in your code to check for attachments before calling /pdf/merge

### Helpful Tips

* Always check that the file array has one or more items
* Validate file URLs or objects before sending to PDF.co
* This saves credits and avoids unnecessary merge attempts

## I Want to Merge PDF Files (or Other Documents)

You want to combine multiple files into a single PDF using PDF.co. PDF.co offers two endpoints depending on what kind of files you're merging.

### General Workflow

* Choose the right endpoint for your files
* Prepare your input URLs or upload files
* Run the merge process using your platform (API, Zapier, Make, etc.)
* Download the merged file from the output URL

### Which Merge Endpoint Should I Use?

| Use Case                               | Endpoint        |
| -------------------------------------- | --------------- |
| Only PDF files                         | Use /pdf/merge  |
| Mix of PDFs, images, Word, Excel, etc. | Use /pdf/merge2 |

### Platform-Specific Related Resources

* Zapier:
  * [How to Merge Files Using Zapier and PDF.co](https://pdf.co/tutorials/how-to-merge-files-using-zapier-and-pdf-co)
  * [How to Merge ZIP, Doc, XLS, RTF, PNG, JPG Files into Single PDF using Zapier](https://pdf.co/tutorials/merge-zip-documents-images-to-pdf)
* Make:
  * [Merge PDF Files using PDF.co and Make](https://pdf.co/tutorials/merge-pdf-files-integromat)
* Other Integrations:
  * [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Files are merged in the order you list them
* You can upload files first using the File Upload API
* Merging large files? Use async: true to avoid timeouts. You’ll need to check when the job is complete before downloading. [Learn how async mode works](/api-reference/async-and-sync-mode)

## I Want to Reorder Pages in a PDF

You need to rearrange the pages of a PDF document—such as moving page `5` to the end or placing page `2` at the beginning.​

### How to Reorder Pages

To reorder pages, you'll use two steps

1. Split the PDF into separate parts.
2. Merge the parts back together in the desired order.

### Example: Move Page 5 to the End

For a `10-page` PDF where you want to move page `5` to the end:​

Split the PDF:

* Use the [/pdf/split](/api-reference/pdf-split) endpoint with the pages parameter set to `1-4,5,6-10`.
* This will produce three PDFs:
  * Pages `1–4`
  * Page `5`
  * Pages `6–10`
    Merge the PDFs:
* Use the [/pdf/merge](/api-reference/pdf-merge) endpoint.
* Provide the URLs of the split PDFs in the desired order:
  * Pages `1–4`
  * Pages `6–10`
  * Page `5`

This will result in a new PDF with pages ordered as `1–4, 6–10, 5`.​

### Platform-Specific Related Resources

**Zapier**:

* [How to Merge Files Using Zapier and PDF.co](https://pdf.co/tutorials/how-to-merge-files-using-zapier-and-pdf-co)
* [How to Merge ZIP, Doc, XLS, RTF, PNG, JPG Files into Single PDF using Zapier](https://pdf.co/tutorials/merge-zip-documents-images-to-pdf)
* [How to Split PDF by Text using PDF.co and Zapier](https://pdf.co/tutorials/how-to-split-pdf-by-text-zapier)

**Make**:

* [Merge PDF Files using PDF.co and Make](https://pdf.co/tutorials/merge-pdf-files-integromat)
* [Splitting Large PDF with Multiple Pages using PDF.co and Make](https://pdf.co/tutorials/split-large-pdf-with-multiple-pages-using-make)
* **Other Integrations** :
  [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Use `"pages": "*"` to split each page into a separate file.
* For large files, set "async": true and monitor the job status.
* Ensure the merge order reflects the desired final page sequence.​

## I Want to Insert an Empty Page into a PDF

You need to insert a blank page into a PDF document—whether at the beginning, middle, or end of the file.

### How to Insert an Empty Page

To insert an empty page into a PDF, you'll use two main steps:

1. Split the PDF if you need to insert in the middle.
2. Merge the parts of the PDF along with the blank page in the correct order.

You can quickly generate an empty PDF page using the [PDF Edit Add Helper tool](https://app.pdf.co/pdf-edit-add-helper).

**Simply follow these steps:**

1. Visit [https://app.pdf.co/pdf-edit-add-helper](https://app.pdf.co/pdf-edit-add-helper).
2. On the canvas that appears, click anywhere on the blank page to activate the editor.
3. Do not add any text or elements—this will ensure the page remains empty.
4. Click "Generate PDF and Preview".
5. Once the preview appears, click "Download PDF" to save your blank page.

This file will now serve as your empty PDF page, which you can insert into another document using the merge method.

### Example 1: Insert a Blank Page at the Beginning or End

If you already have a blank PDF page:

* Insert at the Start: Use the /pdf/merge endpoint with the URLs listed as:
  * `empty_page.pdf, your_main_pdf.pdf`

```json theme={null}
    {
        "url": "empty_page_link_here,https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample2.pdf",
        "async": false
    }
```

Insert at the End: Switch the order of URLs:

* `your_main_pdf.pdf, empty_page.pdf`

```json theme={null}
    {
        "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample2.pdf,empty_page_link_here",
        "async": false
    }
```

### Example 2: Insert a Blank Page in the Middle

For example, to insert an empty page between two pages of a 2-page PDF:

1. Use the [/pdf/split](/api-reference/pdf-split) endpoint with the pages parameter set to `1,2`.
   * This gives two PDFs: Page 1 and Page 2.
2. Merge the parts using [/pdf/merge](/api-reference/pdf-merge):
   * Order: Page 1 → Empty Page → Page 2

```json theme={null}
    {
        "url": "page1_link,empty_page_link,page2_link",
        "async": false
    }
```

### Platform-Specific Related Resources

**Zapier**:

* [How to Merge Files Using Zapier and PDF.co](https://pdf.co/tutorials/how-to-merge-files-using-zapier-and-pdf-co)
* [How to Merge ZIP, Doc, XLS, RTF, PNG, JPG Files into Single PDF using Zapier](https://pdf.co/tutorials/merge-zip-documents-images-to-pdf)

**Make**:

* [Merge PDF Files using PDF.co and Make](https://pdf.co/tutorials/merge-pdf-files-integromat)

**Other Integrations**:

* [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Only working with PDF files? → Use the [/pdf/merge](/api-reference/merge) endpoint.
* Merging a mix of PDFs, images, Word, Excel, etc.? → Use the [/pdf/merge2](/api-reference/merge/various-files) endpoint.
* Use the PDF Edit Add Helper Tool to create a blank PDF page quickly.
* Use `"pages": "*"` to split each page into separate files.
* For large files, set `"async": true` and monitor job status.
* Ensure merge order matches your desired page sequence.

## I Want to Merge Password-Protected PDFs

You need to merge two or more PDF documents that are password-protected—such as combining encrypted reports or forms into a single file.

**Important**: While we plan to add built-in password removal in an upcoming update to the PDF Merger API, this feature is not yet available.

For now, you'll need to first remove the password using the PDF Security API ([/pdf/security/remove](/api-reference/pdf-password/remove)), and then pass the unlocked PDFs into the PDF Merger API.

### How to Merge Password-Protected PDFs

To merge password-protected PDFs, you'll use three steps:

1. Remove the Password from Each PDF
2. Merge the Unprotected PDFs
   (Optional) Re-apply Password Protection to the Final Merged PDF

### Example: Merge Two Secured PDFs

You have two password-protected PDFs that you want to combine.
Step 1: Remove the Passwords

* Use the [/pdf/security/remove](/api-reference/pdf-password/remove) endpoint.
* Provide the file URL and password to decrypt each file.
  Step 2: Merge the Unlocked PDFs
* Use either the [/pdf/merge](/api-reference/merge/pdf) or [/pdf/merge2](/api-reference/merge/various-files) endpoint.
* Pass the URLs of the unprotected files in the desired order.
  Step 3 (Optional): Add a New Password
* If you want to secure the final merged document, use the [/pdf/security/add](/api-reference/pdf-password/add) endpoint.
* Specify the new password and permissions.

### Platform-Specific Related Resources

**Zapier**:

* [Convert Google Docs into Password-Protected PDF using PDF.co and Zapier](https://pdf.co/tutorials/convert-google-docs-into-password-protected-pdf-zapier)
* [How to Merge Files Using Zapier and PDF.co](https://pdf.co/tutorials/how-to-merge-files-using-zapier-and-pdf-co)
* [How to Merge ZIP, Doc, XLS, RTF, PNG, JPG Files into Single PDF using Zapier](https://pdf.co/tutorials/merge-zip-documents-images-to-pdf)

**Make**:

* [Convert Google Docs into Password-Protected PDF using PDF.co and Make](https://pdf.co/tutorials/convert-google-docs-into-password-protected-pdf-make)
* [Merge PDF Files using PDF.co and Make](https://pdf.co/tutorials/merge-pdf-files-integromat)

**Other Integrations**:

* [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Only working with PDF files? → Use the [/pdf/merge](/api-reference/merge/pdf) endpoint.
* Merging a mix of PDFs, images, Word, Excel, etc.? → Use the [/pdf/merge2](/api-reference/merge/various-files) endpoint.
* Always remove passwords before attempting to merge.
* Use [/pdf/security/add](/api-reference/pdf-password/add) after merging if you need to re-secure the final file.
* Ensure that the original file URLs are accessible if using cloud-based tools.

## How to Merge Files and Get a Uniform Page Size

By default, [/pdf/merge](/api-reference/merge/pdf) and [/pdf/merge2](/api-reference/merge/various-files) keep the original page sizes of the source files. If your input files have different page sizes, the merged PDF will also have mixed sizes.

### How to Ensure a Uniform Page Size

* Standardize the page size before merging:
* Adjust the page size in each source document using their original editor.
* Export all files to PDF (if applicable)
* Merge the documents
* Use [/pdf/merge](/api-reference/merge/pdf) to combine PDFs only.
* Use [/pdf/merge2](/api-reference/merge/various-files) if combining PDFs with other file types (images, Word, Excel, etc.).

**Important Notes**:

* PDF.co cannot change or standardize page sizes at merge time.
* Any size differences must be fixed before exporting to PDF.
* PowerPoint and Word automatically scale content when resizing pages.

### When to Use /pdf/merge vs /pdf/merge2:

| Endpoint                                          | Use Case                                         |
| ------------------------------------------------- | ------------------------------------------------ |
| [/pdf/merge](/api-reference/merge/pdf)            | Merge PDFs only (faster, uses fewer credits)     |
| [/pdf/merge2](/api-reference/merge/various-files) | Merge PDFs + images + Word + Excel + other files |

### Helpful Tips:

* For large files, use "async": true to process asynchronously.
* Use [/pdf/info](/api-reference/pdf-info-reader) to check page sizes in PDFs before merging.
* If merging scanned files, ensure they were created/exported with the same page size.

## I Want to Split PDF Pages and Rename Each by Its Text Content

You need to split a PDF document into separate pages and rename each file based on its text content—such as a customer name, invoice number, or ID.

### How to Split and Rename PDF Pages

To split and rename each page, you'll follow three steps:

1. Split the PDF into individual pages.
2. Extract text from each page.
3. Rename each page using the extracted text.

### Example: Split and Rename by Customer Name

For a multi-page PDF (e.g., invoices), where each page is for a different customer:

1. Split the PDF

* Use the [/pdf/split](/api-reference/pdf-split) endpoint with the parameter:
  * `"pages": "*"`
* This will split each page into a separate file.

2. Extract Text

* Use the [/pdf/documentparser](/api-reference/documentparser/overview) endpoint to extract identifying information (e.g., customer name) from each split PDF.

3. Rename Each PDF

* Use the output from the document parser to rename the PDF using meaningful identifiers (like `Customer_JohnDoe.pdf`).

### Platform-Specific Related Resources

* [Make/Integromat: Split PDF and Extract Text](https://pdf.co/split-large-pdf-with-multiple-pages-parse-using-make)
* [Make/Integromat: Rename PDF Using Extracted Data](https://pdf.co/rename-pdf-file-using-pdfco-and-integromat)
* **Other Integrations**: [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Use `"pages": "*"` to split every page individually.
* Set `"async": true` for large files to avoid timeouts.
* Make sure each page has unique, extractable text for clear renaming.
* Use the extracted values as dynamic filenames in your automation.

## I Want to Split a PDF into Individual Pages

You need to separate each page of a PDF into its own individual PDF file—for example, turning a 4-page document into 4 separate single-page PDFs.

### How to Split a PDF into Individual Pages

To split a PDF, you’ll use the [/pdf/split](/api-reference/pdf-split) endpoint and the special `"pages": "*"` parameter. This tells PDF.co to split every page into its own individual file.

### Example: Split a 4-Page PDF into Individual Pages

If you have a 4-page PDF and want to extract each page as a standalone file:
Split the PDF:

* Use the [/pdf/split](/api-reference/pdf-split) endpoint with the following input:

```json theme={null}
    {
        "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-split/sample.pdf",
    "pages": "*"
    }
```

This will return 4 separate PDF URLs:

* Page 1 - `https://pdf-temp-files.s3.us-west-2.amazonaws.com/BX1VZ5KCFEA7Z764XMX6…...`
* Page 2 - `https://pdf-temp-files.s3.us-west-2.amazonaws.com/1KQXP5H6MPDF0R8……….….`
* Page 3 - `https://pdf-temp-files.s3.us-west-2.amazonaws.com//GEVFWLNV6LYS5YJ0N……....`
* Page 4 - `https://pdf-temp-files.s3.us-west-2.amazonaws.com/VP4XBM4V30DAKTKSCV……..`

### Using Make/Integromat for Over 25 Pages

If you're working in Make (formerly Integromat) and want to split a PDF with more than 25 pages:

1. Create a new scenario.
2. Use the PDF.co Make an API Call module.
3. Set API Endpoint to `/v1/pdf/split`.
4. In the Input Type field, choose to **Override the `url` param with a value** and enter the URL of the PDF file you want to split.
5. Click on `Add item` under the `Body` section.
6. Run the scenario.

**Note**: The standard Split a PDF module in Make supports only up to 25 pages.

### Platform-Specific Related Resources

* [Make/Integromat: Split Large PDF With Multiple Pages in Make](/integrations/make/split-pdf)
* **Other Integrations**: [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Use `"pages": "*"` to split each page into its own file.
* Use `"pages": "1,2-5,7-"` to define custom ranges (e.g., pages 1, 2–5, and 7 to the end).
* If splitting a large PDF (e.g., 100+ pages), set `"async": true` and monitor the job status.
* The Split module in Make has a 25-file limit. For more pages, use the **Make an API Call** module instead

## I Want to Split More Than 25 Pages in Make (Integromat)

You’re trying to split a PDF with more than 25 pages in Make (formerly Integromat), but you're hitting a limitation—only 25 output files are generated

### Why This Happens

This issue occurs because of **Make’s timeout limitation**. When using the PDF.co **Split a PDF** module with the\*\* "Download a File"\*\* export type, only up to 25 output files are processed before the module times out.

### How to Split More Than 25 Pages

To bypass this limitation, use the **"JSON Output"** export type instead of **"Download a File"**. This avoids the timeout constraint and provides you with direct URLs to all the split files, even when there are more than 25 pages.

### Do This Instead:

In the Split a PDF module in Make:

* Go to the **"Export Type"** field.
* Select **"JSON Output"** (instead of **"Download a File"**).
  This method returns all file links in a single structured JSON response, effectively bypassing the 25-file limit.

### Platform-Specific Related Resources

* [Api Documentation](/api-reference/pdf-split/by-pages)
* [Make/Integromat](/integrations/make/split-pdf)
* [Zapier](/integrations/zapier/split-pdf)

### Helpful Tips

* Always use **"JSON Output"** if splitting more than 25 pages.
* For large PDFs, set `"async": true` and monitor job status.

## I Want to Split a PDF by File Size

You need to split a large PDF into smaller parts based on file size—such as creating 10MB chunks from a 30MB file.

### Why This Happens

The PDF.co [/pdf/split](/api-reference/pdf-split) endpoint does not split by file size directly. Instead, it splits by page range. To achieve size-based splitting, you first need to estimate the file size per page, then calculate how many pages to include in each chunk.

### How to Split by File Size

To split a PDF into evenly sized chunks (e.g., 10MB parts), you’ll use the [/pdf/split](/api-reference/pdf-split) endpoint with calculated page ranges.

**Step 1: Determine File Size per Page**
Split the first page of the PDF using the /pdf/split endpoint to estimate the size of a single page. This will help you figure out how many pages make up your target file size (e.g., 10MB).

**Step 2: Define Page Ranges Based on Size**
Once you know the size per page, use it to define page groups. For example, if each page is \~1MB and your target is 10MB per file, group 10 pages per output file.

### Example: Split a 30MB PDF into 3 parts of 10MB each

Use the [/pdf/split](/api-reference/pdf-split) endpoint with this input:

```json theme={null}
    {
        "url": "https://fileurl",
        "pages": "1-10,11-20,21-30"
    }
```

This will return three PDFs, each containing 10 pages and approximately 10MB in size.

### Platform-Specific Related Resources

* [Make/Integromat:Split Large PDF With Multiple Pages in Make](/integrations/make/split-pdf)
* [Zapier: Split PDF by File Size](/integrations/zapier/split-pdf)
* **Other Integrations**: [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

### Helpful Tips

* Use `"pages": "*"` to split each page individually (useful for accurate sizing).
* For large files, set `"async": true` and monitor job status.
* Always check the actual size of the output files—some pages may vary in content size.

## I Want to Find and Remove Empty Pages from a PDF

You need to automatically detect and remove empty pages from a PDF—where an “empty page” means a page **without any text content** (even if it contains whitespace or images).

### How to Remove Empty Pages

To remove empty pages, follow this step-by-step workflow:

**Get the number of pages**

* Use the [/pdf/info](/api-reference/pdf-info-reader) endpoint to retrieve the total page count of the PDF.

**Check each page for text**

* Loop through each page.
* Call [/pdf/convert/to/text-simple](/api-reference/pdf-to-text/simple) for every page.
  Evaluate the result: if the returned text is empty, mark the page as empty.

**Remove empty pages**

* Option 1: Use [/pdf/edit/delete-pages](/api-reference/pdf-delete-pages) to delete all identified empty pages in one call.
* Option 2: Use [/pdf/split](/api-reference/pdf-split/by-pages) to split out the non-empty pages, then [/pdf/merge](/api-reference/merge/pdf) to recombine them into a new PDF.

### Example Workflow

Suppose your PDF has 10 pages:

* /pdf/info returns 10 pages.
* Loop pages 1–10 → call [/pdf/convert/to/text-simple](/api-reference/pdf-to-text/simple) on each.
* If pages 3 and 7 are empty → pass "pages": "3,7" to [/pdf/edit/delete-pages](/api-reference/pdf-delete-pages).
  Result: new PDF with 8 pages (empty pages removed).

### Helpful Tips

* This workflow detects **empty text pages**. It won’t detect image-only or scanned pages unless OCR is enabled.
* If dealing with scanned PDFs, use [/pdf/makesearchable](/api-reference/pdf-change-text-searchable/searchable) first to apply OCR, then run this process.
* Large PDFs? → Set "async": true for long-running jobs and check job status.

***

# [Search and Delete](/api-reference/pdf-search-text-and-delete)

## I Want to Fix Text Alignment When Replacing Text in a PDF

You need to replace text in a PDF, but the new text appears slightly misaligned—often sitting higher or lower than the original content.​

### How to Fix Text Alignment

To correct the alignment of replaced text, you’ll use a special parameter to adjust the vertical position:

* Use the [/pdf/edit/replace-text](/api-reference/pdf-search-text-and-replace/text) endpoint to perform the replacement.
* Add the `YAdjustmentForReplacementText` setting in the `profiles` parameter to shift the text up or down.

### Example: Move Replaced Text 1 Unit Up

Let’s say you want to replace "200.00" with "600.00" and adjust the new text slightly upward to align it better with the original text.
Here’s how:

**API Request**

### `POST` [/v1/pdf/edit/replace-text](/api-reference/pdf-search-text-and-replace/text)

```json theme={null}
{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
  "searchString": "200.00",
  "replaceString": "600.00",
  "caseSensitive": true,
  "replacementLimit": 1,
  "pages": "",
  "password": "",
  "name": "Output",
  "async": false,
  "profiles": "{ 'YAdjustmentForReplacementText': '-1' }"
}
```

This setting moves the replaced text 1 unit upward, improving alignment with the surrounding text.

### Helpful Tips

* Use negative values (e.g., `-1`) to move text up, and positive values to move it down.
* Test a few values like `-0.5`, `-1`, or `+1` to find the best alignment for your document’s font and layout.
* Always include the adjustment in the `profiles` field in JSON format.

## I Want to Replace Text in a PDF with Hebrew (Multilingual Support)

You're trying to replace text in a PDF with a Hebrew (or other right-to-left language) string, but only the first word appears correctly. This can happen due to character encoding or rendering limitations in the PDF format.

<Note> This is a known issue, and our developers are currently working on a fix.</Note>

### How to Fix Text Replacement with Hebrew

To replace text successfully with Hebrew scripts, use this workaround:

### Add a Space After the Hebrew Text

Due to the issue mentioned above, replacing text with multiple Hebrew words currently works only when a space is added at the end.

### Example Fix:

If you're replacing “Your Company Name” with the Hebrew phrase “אחת שתיים”, make sure to include a trailing space:

```json theme={null}
{
  "searchString": "Your Company Name",
  "replaceString": "אחת שתיים "
}
```

This will ensure the full phrase renders correctly in the output PDF.

### Platform-Specific Related Resources

* [Zapier Search and Replace PDF Text in Zapier](https://pdf.co/tutorials/search-and-replace-text-in-pdf-using-pdfco-and-zapier)
* [Make Search and Replace PDF Text in Make/Integromat](https://pdf.co/tutorials/search-and-replace-text-in-pdf-using-pdfco-and-integromat)
* **Other Integrations**: [Contact us](https://pdf.co/support/request?subject=Knowledgebase%20-%20I%20need%20help%20with%20PDF.co) for guidance on specific platforms.

<Tip>
  **Helpful Tips:**

  * Always test your output PDF when working with RTL or multilingual content.
  * For better compatibility, make sure your Hebrew text is encoded in UTF-8.
</Tip>

## What’s the Most Cost-Effective Way to Search for Text in PDFs?

You want to search for text across multiple PDF documents—but running a live text search inside PDFs every time is slow, resource-heavy, and costly.
The best approach is to extract text once using PDF.co, then search against that extracted data in your own database or system.

### Recommended Workflow

Here’s how you can build a cost-effective solution using PDF.co:

**Extract text from PDFs with PDF.co**

* Use [/pdf/convert/to/text](/api-reference/pdf-to-text/basic) or [/pdf/convert/to/text-simple](/api-reference/pdf-to-text/simple) endpoint.
* Run this once for each PDF.
* Optionally include page numbers if you need page-level references.

**Store the extracted text outside PDF.co**

* Save the extracted text in your own database or storage system.
* You control how to organize the data (by document, by page, etc.).

**Search text using your own database or tools**

* Run all search queries against your stored text—not directly in PDFs.
* This avoids repeatedly processing PDF files.

### Why This Approach is Better

PDFs aren’t designed for direct text search—they’re designed for display, not querying.
By extracting text once:

* You reduce API calls and credit usage on PDF.co
* You avoid repeated PDF processing for every search query
* You gain faster search speeds through your own database indexing

### What PDF.co Provides

PDF.co provides the PDF to text extraction step only.
The database storage, search engine, and interface for searching are handled on your side using your preferred tools or systems.

### Example Use Case

* Extract text from 1,000 PDFs with [/pdf/convert/to/text](/api-reference/pdf-to-text/simple)
* Save the text results in your SQL, NoSQL, or search engine database
* Add full-text search capability using your system (e.g., ElasticSearch, PostgreSQL, etc.)
* Every future search now queries your database—not the original PDFs—saving API credits and speeding up results.

<Tip>
  **Helpful Tips:**

  * If PDFs contain scanned images, enable OCR during extraction.
  * Store page numbers alongside text if you need to reference exact locations.
  * Batch extraction is recommended if processing large sets of PDFs.
</Tip>

## I Want to Change the Font of Text in a PDF

You need to change the font of specific text in a PDF document—such as replacing plain text with styled text using a different font, size, or color.

### How to Change Text Font

To change the font of existing text, you'll use two steps:

* **Delete** the existing text.
* **Add** new text with your desired font settings.

### Example: Change a Text's Font Style

If you want to update a phrase like "Sample Text" to use **Comic Sans MS** with a larger font size and a different color:

**Step 1: Remove the Old Text:**
Use the [/pdf/edit/delete-text](/api-reference/pdf-search-text-and-delete) endpoint to remove the original phrase from the PDF.

**Step 2: Add New Text with Your Chosen Font:**
Use the [/pdf/edit/add](/api-reference/pdf-add) endpoint to insert the new text.

Here's a sample payload:

```json theme={null}
"annotations": [
    {
        "text": "Sample Text",
        "x": 250,
        "y": 240,
        "size": 24,
        "pages": "0-",
        "color": "CCBBAA",
        "fontName": "Comic Sans MS",
        "fontItalic": true
    }
]
```

This example changes the text font to **Comic Sans MS**, sets the font size to **24**, applies *italic* styling, and changes the color.

### Helpful Tips

You can adjust font styles using: `"fontName"`, `"size"`, `"color"`, `"fontBold"`, `"fontItalic"` options.

* Use page range `"pages": "0-"` to apply edits to all pages.
* For precise text replacement, try combining with [/pdf/find](/api-reference/pdf-search-text-and-delete) to locate exact positions.

## I Want to Search and Replace Text and Set Text Alignment

You need to replace existing text in a PDF and also set the alignment of the new text—such as centering a new address after replacing the old one.

### How to Search, Replace, and Align Text

To achieve this, you'll use two steps:

* **Remove** the unwanted text using the [/pdf/edit/delete-text](/api-reference/pdf-search-text-and-delete) endpoint.
* **Add** the new aligned text using the [/pdf/edit/add](/api-reference/pdf-add) endpoint.

### Example: Replace and Center Align Address (Zapier Automation)

PDF documents do not support traditional editable text or automatic alignment—each text element is placed at a fixed position on the page.
Here's how to replace and center-align a new address using Zapier:

**Step 1: Delete Existing Text**
Use the [PDF.co Custom API Call](/integrations/zapier/custom-api-call) module in Zapier to call the [/pdf/edit/delete-text](/api-reference/pdf-search-text-and-delete) endpoint. This allows you to precisely target and remove the original string you want to replace.

**Step 2: Add New Text with Alignment**
Then use the [PDF.co PDF Filler](/integrations/zapier/pdf-filler) action to add the new text. To align it properly:

* Set the `width` of the text box to match the page width
* Specify alignment as `center`, `left`, or `right`

### Example for center-aligned text on an A4 page (width = 842):

```json theme={null}
0;50;0;2138 Dawson Drive, Little Rock, Arkansas, 72211;8;Helvetica;000000;;false;842;20;center
```

### Helpful Tips

* Always specify the correct page width when aligning text.
* Use the same font size and style if you want to maintain visual consistency.
* Use coordinates and alignment settings carefully—PDFs don’t flow like Word docs.

# [PDF Fill, Edit, Add](/api-reference/pdf-add)

## I Want to Avoid Text Overflow When Adding Text to PDFs

You’re trying to add text into a PDF but it gets cut off or extends beyond the page. This is known as **text overflow**, and it usually happens when the textbox size or alignment doesn’t properly fit the text you’re inserting.

### How to Avoid Text Overflow

To prevent text overflow, you'll need to use five key parameters:

* `x` and `y` coordinates (to place the text)
* `width` and `height` of the textbox (to define the area)
* Text `alignment` (to control how text wraps within the box)

To find the right coordinates for positioning, you can use our [PDF Inspector Tool](https://app.pdf.co/pdf-edit-add-helper).

### API Example

To avoid overflow when using the [/pdf/edit/add](/api-reference/pdf-add) endpoint, set values like this:

```json theme={null}
POST /v1/pdf/edit/add
Host: api.pdf.co
x-api-key: your_api_key

{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/sample.pdf",
  "annotations": [
    {
      "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit...",
      "x": "10",
      "y": "10",
      "width": "500",
      "height": "200",
      "size": "7",
      "pages": "0",
      "alignment": "left"
    }
  ]
}
```

This ensures the text fits nicely inside the defined box.

### Platform-Specific Guide

* **Zapier**
  * Use the Text Objects field to define:
    * Width: `133`
    * Height: `100`
    * Alignment: `left`
    * Example format:
      ```json theme={null}
      459;12;0;your text here;12;Arial;;;;133;100;left
      ```

* **Make/Integromat**
  * In the Text Annotations section:
    * Click **Add Item**
    * Enter `width`, `height`
    * Choose `alignment`
    * This prevents overflow by ensuring the text is correctly bound.

### Helpful Tips

* Set adequate **height** if your text is long.
* Use small **font sizes** (like `7-12`) to fit more content within limited space.

## I Want to Rename PDFs Using Extracted Text

You want to rename one or multiple PDF documents—such as naming each PDF based on a unique reference number or identifier extracted from within the document itself.

### Why It Happens

PDFs often lack meaningful file names, making them hard to organize. If your documents include internal identifiers (like reference numbers or invoice codes), you may want to use those to rename each file automatically for easier tracking and sorting.

### How to Rename PDF Files Using Extracted Text

To rename PDF files based on text inside them, you’ll use two steps:

* **Extract the text** (e.g., a reference number) from the document.
* **Rename the PDF using** that extracted value.

### Example: Rename a PDF Using a Reference Number

Let’s say you receive PDF forms and want to name each file using the reference number shown on the first page.

**Step 1 – Extract the Reference Number:**

Use the [/pdf/documentparser](/api-reference/documentparser/overview) endpoint with a custom template:

* Create a template using the **Document Parser Online Template Editor**. Our [walkthrough video](https://www.youtube.com/watch?v=fp3QafM1qlU) shows you how to use the Document Parser Online Template Editor.
* Use the template to extract the unique identifier (like a ref. number).

**Step 2 – Rename the File:**

Use the [/pdf/edit/add](/api-reference/pdf-add) endpoint to rename the PDF:

* Pass in the original file URL.
* Set the output file name using the identifier from Step 1.

### Platform-Specific Guide

* **Zapier**
  * Create a Document Parser template.
  * Add the PDF.co Document Parser action.
  * Input the PDF URL and Template ID.
  * Extract the identifier (e.g., reference number).
  * Follow this tutorial to rename the file:
    * [Zapier Tutorial – Rename PDF using PDF.co](https://pdf.co/rename-pdf-using-pdfco-and-zapier)

* **Make/Integromat**
  * Create a Document Parser template.
  * Add the Parse a Document module.
  * Input the PDF URL and Template ID.
  * Run the module to extract the identifier.
  * Follow this tutorial to rename the file:
    * [Integromat Tutorial – Rename PDF using PDF.co](https://pdf.co/rename-pdf-file-using-pdfco-and-integromat)

### Helpful Tips

* You can test your Document Parser templates in the online editor before use.
* Make sure your reference number or identifier is clearly placed and consistently formatted.
* Combine with filters or conditions to rename only specific PDFs.

## How to Add Text to a PDF and Email It to a Customer

You want to add content (like text or images) to a PDF and **then email the updated PDF to your customer.**

This process involves **two steps**:

* Add text/images to the PDF
* Send the updated PDF via email

Let's go through it:

**Step 1: Add Text or Images to the PDF**

Use the [/pdf/edit/add](/api-reference/pdf-add) endpoint to:

* Add text (like names, notes).
* Insert images (like logos, signature).
* Add hyperlinks.
* Fill out a PDF form.

API Docs: [Add Text & Images](/api-reference/pdf-add) | [Fill PDF Form](/api-reference/pdf-add#create-fillable-pdf-forms)

**Step 2: Send the Final PDF via Email**

Use the [/email/send](/api-reference/email/send) API to email the updated PDF file.

API Docs: [Send Email](/api-reference/email/send)

### Platform-Specific Setup

**Zapier**

1. To achieve this on Zapier, you will be required to configure two PDF.co actions.

* The first action is PDF.co PDF Filler.
* If you have a standard PDF, you can refer to this tutorial for guidance: [https://pdf.co/add-text-and-images-with-links-to-a-pdf-using-zapier](https://pdf.co/add-text-and-images-with-links-to-a-pdf-using-zapier)
* If you have a fillable PDF form, you'll find this tutorial helpful: [https://pdf.co/how-to-fill-pdf-forms-using-zapier](https://pdf.co/how-to-fill-pdf-forms-using-zapier)

2. The second action you need to configure is PDF.co Send Email.

* To use our [/email/send](/api-reference/email/send) endpoint, you can follow the Zapier integration guide for step-by-step instructions on how to set it up. [Zapier Integration Guide](/integrations/zapier/email-send)
* Alternatively, if you are a Gmail / Google Mail user and would like to utilize the Gmail plugin, you can take a look at our available guide here [Generate PDF from Jotform](/integrations/zapier/generate-pdf-from-jotform)

**Make/Integromat**

1. To accomplish this task on Integromat/Make, you will need to set up two PDF.co modules.

* The first module can be either PDF.co Add Text and Image to PDF or PDF.co Fill a Form.
* If you need to fill out a PDF form, you can refer to this comprehensive guide: [https://pdf.co/fill-w9-form-using-pdfco-and-integromat](https://pdf.co/fill-w9-form-using-pdfco-and-integromat).

2. The second module that you need to set up is the PDF.co Send Email with Attachments.

* To use our [/email/send](/api-reference/email/send) endpoint, jump to step 9 in this guide [https://pdf.co/tutorials/send-emails-with-pdf-data-using-make](https://pdf.co/tutorials/send-emails-with-pdf-data-using-make)
* If you're a Gmail / Google Mail user, you can use this guide to send the PDF output to your customer's email address using the Gmail plugin: [https://pdf.co/send-emails-from-gmail-with-data-from-pdfs-integromat#4](https://pdf.co/send-emails-from-gmail-with-data-from-pdfs-integromat#4).

### For Developers

If you're working directly with the API:

* For adding text, images, links, and filling out PDF forms, you can refer to the following documentation and code samples:
  * Fill PDF Form: [Fill PDF Form](/api-reference/pdf-add#create-fillable-pdf-forms)
  * Add Text, Images, Signature, Links to PDF: [Add Text, Images, Signature, Links to PDF](/api-reference/pdf-add)
* To send an email with an attachment, you can consult the following documentation and code samples:
  * Send Email to Customer Email Address: [Send Email to Customer Email Address](/api-reference/email/send)
  * How to set up SMTP for email via GMAIL: [How to set up SMTP for email via GMAIL](/knowledgebase/smtp-guide/how-to-setup-smtp-for-email-via-gmail)

### Helpful Tips

* If you're using Zapier or Make, PDF.co handles both steps seamlessly.
* You can include custom sender names or subjects using `email/send` parameters.
* Always test with sample data before going live.

## I Want to Set Width and Height for an Image in Zapier (Without a Clickable Link)

You’re trying to insert an image into a PDF using Zapier and want to define the image’s width and height—but you don’t want the image to include a clickable hyperlink.

### Why This Happens

When adding an image to a PDF using Zapier (or when using the simplified input format), the image link format expects **all parameters to be present**, including the clickable URL. If you omit the clickable link entirely, the system may misread the formatting or fail to apply the image correctly.

### How to Add the Image Without a Clickable Link

To handle this, you’ll still include the **clickable link parameter**, but simply leave it **empty**. All parameters must be present—even if you’re not using all of them.

### Example: Remove Clickable Link While Setting Width and Height

Instead of using:

```json theme={null}
20;80;0-;pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/logo.png;www.pdf.co;200;200
```

Use:

```json theme={null}
20;80;0-;pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/logo.png;;200;200
```

This keeps the formatting correct, applies the width and height, and removes the clickable link from the image.

### Helpful Tips

* Always include **all parameters** in your format, even if some are empty.
* Separate values with `;` as shown in the example.
