Find and replace text in a PDF
About this tool
How to use it
- Choose this tool.
- Add your PDF.
- Type the text to find and the text to put in its place, or add several pairs.
- Choose options such as which pages, matching upper and lower case, whole words only, and the font and colour of the new text.
- Press Generate, then download the new PDF.
What you get back
Try Find and replace text in a PDF in the Studio
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/replace-text" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'file=@document.pdf' \
-F 'find=Acme Ltd' \
-F 'replace=Acme Inc' \
-F 'rules=[{"find":"2025","replace":"2026"}]'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.replaceText({
"file": 'document.pdf',
"find": "Acme Ltd",
"replace": "Acme Inc",
"rules": "[{\"find\":\"2025\",\"replace\":\"2026\"}]"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->replaceText([
'file' => 'document.pdf',
'find' => 'Acme Ltd',
'replace' => 'Acme Inc',
'rules' => '[{"find":"2025","replace":"2026"}]',
]);
echo $result->requestId;