Link Search Menu Expand Document

PDF Search and Delete Text from PDF

Explore Samples

Search text in PDF and remove found text from PDF.

Available Methods

[POST] /pdf/edit/delete-text (single replacement)

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage.

For uploading files via API please check Files Upload section.

If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching.

You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
searchStrings[] required
The array of strings to search.
caseSensitive optional
Set to false to use case-insensitive search.
regex optional
Set to true to use regular expression for search string(s).
replacementLimit optional
Limit the number of searches & replacements for every item. The default value is 0 which means unlimited searches and replacements so every found occurrence will be replaced.
name optional
File name for the generated output, The input must be in string format.
expiration optional
Output link expiration in minutes. The default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage.
Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
password optional
Password of PDF file, The input must be in string format.
pages optional
Comma-separated list of page indices (or ranges) to process.
IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the of the document). For ALL pages just leave this param empty.
Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document, The input must be in string format.
async optional
Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working, failed, aborted and success). Must be one of: true, or false.
IMPORTANT: Also set the inline param to true to get a direct link to the final output pdf in both sync and async modes. Otherwise, you will be getting a direct link to pdf in sync mode but also a link to the .json file in the async mode.
profiles optional
Use this parameter to set additional configurations for fine-tuning and extra options. Explore PDF.co knowledgebase for profile examples, The input must be in string format.
  • Method: POST
  • URL: /v1/pdf/edit/delete-text

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
    "name": "pdfWithTextDeleted",
    "caseSensitive": "false",
    "searchString": "Invoice",
    "replacementLimit": 0,
    "async": false
}

Example responses

/pdf/edit/delete-text (single replacement)
{
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/ZOSEQZFNVCYLD5N5CJFVIYQKBVLR8OKD/pdfWithTextDeleted.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzECYaDKOO4WmO5C5shyOYYSKCAVsAo6VkB5HQjTBd9dMlJujQdEkPfNdPeLfq2mF54s2ESZBmIAJ5UgDUo3J9R475CCS4M3nuuo%2FSJwRy5gNiJdb1ZY0uCtP87x83nH%2B%2BSDu5JK%2F%2BEOrd3MREt8KE3BsQOrv%2FKMdnK%2BT5nJ2x2hC87vHue%2FudY7%2FWX54vx4tfFobEyhEozLbPnwYyKOdEsYYWH7e8tm7XV4UeKxCoKMaXSEPvOod80hR62qXnEI42fOsON3M%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHLUVIAIPX/20230220/us-west-2/s3/aws4_request&X-Amz-Date=20230220T205521Z&X-Amz-SignedHeaders=host&X-Amz-Signature=9f79c1a30d4f373e495e735e908375dad2ae6dcafcee761a477748c2b8298605",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "pdfWithTextDeleted.pdf",
    "credits": 21,
    "duration": 189,
    "remainingCredits": 96235635
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/delete-text' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
    "name": "pdfWithTextDeleted",
    "caseSensitive": "false",
    "searchString": "Invoice",
    "replacementLimit": 0,
    "async": false
}'

[POST] /pdf/edit/delete-text (delete and draw color)

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage.

For uploading files via API please check Files Upload section.

If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching.

You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
searchStrings[] required
The array of strings to search.
caseSensitive optional
Set to false to use case-insensitive search.
regex optional
Set to true to use regular expression for search string(s).
replacementLimit optional
Limit the number of searches & replacements for every item. The default value is 0 which means unlimited searches and replacements so every found occurrence will be replaced.
name optional
File name for the generated output, The input must be in string format.
expiration optional
Output link expiration in minutes. The default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage.
Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
password optional
Password of PDF file, The input must be in string format.
pages optional
Comma-separated list of page indices (or ranges) to process.
IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the of the document). For ALL pages just leave this param empty.
Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document, The input must be in string format.
async optional
Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working, failed, aborted and success). Must be one of: true, or false.
IMPORTANT: Also set the inline param to true to get a direct link to the final output pdf in both sync and async modes. Otherwise, you will be getting a direct link to pdf in sync mode but also a link to the .json file in the async mode.
profiles optional
Use this parameter to set additional configurations for fine-tuning and extra options. Explore PDF.co knowledgebase for profile examples, The input must be in string format.
  • Method: POST
  • URL: /v1/pdf/edit/delete-text

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
    "name": "pdfWithTextDeleted",
    "searchString": "Item \\d+",    
    "regex": true,
    "replacementLimit": 0,
    "caseSensitive": "false",
    "async": false,
    "profiles": "{'UsePatch': true, 'PatchColor': '#000000'}"

}

Example responses

/pdf/edit/delete-text (delete and draw color)
{
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/80D3II85OQALU98Z0OGU4TN4YH9ORQ15/pdfWithTextDeleted.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzECYaDKOO4WmO5C5shyOYYSKCAVsAo6VkB5HQjTBd9dMlJujQdEkPfNdPeLfq2mF54s2ESZBmIAJ5UgDUo3J9R475CCS4M3nuuo%2FSJwRy5gNiJdb1ZY0uCtP87x83nH%2B%2BSDu5JK%2F%2BEOrd3MREt8KE3BsQOrv%2FKMdnK%2BT5nJ2x2hC87vHue%2FudY7%2FWX54vx4tfFobEyhEozLbPnwYyKOdEsYYWH7e8tm7XV4UeKxCoKMaXSEPvOod80hR62qXnEI42fOsON3M%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHLUVIAIPX/20230220/us-west-2/s3/aws4_request&X-Amz-Date=20230220T205504Z&X-Amz-SignedHeaders=host&X-Amz-Signature=0c2208da9014a70728ccefd588ebb9d4d33e54d6763172b3757dff861b7d39b5",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "pdfWithTextDeleted.pdf",
    "credits": 21,
    "duration": 143,
    "remainingCredits": 96235656
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/delete-text' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-text/sample.pdf",
    "name": "pdfWithTextDeleted",
    "searchString": "Item \\d+",    
    "regex": true,
    "replacementLimit": 0,
    "caseSensitive": "false",
    "async": false,
    "profiles": "{'\''UsePatch'\'': true, '\''PatchColor'\'': '\''#000000'\''}"

}'

[POST] /pdf/edit/delete-text (multiple replacements)

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage.

For uploading files via API please check Files Upload section.

If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching.

You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
searchStrings[] required
The array of strings to search.
caseSensitive optional
Set to false to use case-insensitive search.
replacementLimit optional
Limit the number of searches & replacements for every item. The default value is 0 which means unlimited searches and replacements so every found occurrence will be replaced.
name optional
File name for the generated output, The input must be in string format.
expiration optional
Output link expiration in minutes. The default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage.
Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
password optional
Password of the PDF file, The input must be in string format.
pages optional
Comma-separated list of page indices (or ranges) to process.
IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the of the document). For ALL pages just leave this param empty.
Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document, The input must be in string format.
async optional
Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working, failed, aborted and success). Must be one of: true, or false.
IMPORTANT: Also set the inline param to true to get a direct link to the final output pdf in both sync and async modes. Otherwise, you will be getting a direct link to pdf in sync mode but also a link to the .json file in the async mode.
profiles optional
Use this parameter to set additional configurations for fine-tuning and extra options. Explore PDF.co knowledgebase for profile examples, The input must be in string format.
  • Method: POST
  • URL: /v1/pdf/edit/delete-text

Query parameters

No query parameters accepted.

Body payload

{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-search-and-replace/sample-agreement-template-signature-page-1.pdf",
  "searchStrings": [
    "[CLIENT-NAME]",
    "[CLIENT-COMPANY]",
    "[CLIENT-SIGNATURE]",
    "1 FEB 2023"
  ],
    "replacementLimit": 2,
    "async": false,
    "profiles": "{'UsePatch': true, 'PatchColor': '#000000'}"
}

Example responses

/pdf/edit/delete-text (multiple replacements)
{
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/BLPL4O4MECWCBUCXETUHINLSBZ9BM08B/sample-agreement-template-signature-page-1.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzECYaDKOO4WmO5C5shyOYYSKCAVsAo6VkB5HQjTBd9dMlJujQdEkPfNdPeLfq2mF54s2ESZBmIAJ5UgDUo3J9R475CCS4M3nuuo%2FSJwRy5gNiJdb1ZY0uCtP87x83nH%2B%2BSDu5JK%2F%2BEOrd3MREt8KE3BsQOrv%2FKMdnK%2BT5nJ2x2hC87vHue%2FudY7%2FWX54vx4tfFobEyhEozLbPnwYyKOdEsYYWH7e8tm7XV4UeKxCoKMaXSEPvOod80hR62qXnEI42fOsON3M%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHLUVIAIPX/20230220/us-west-2/s3/aws4_request&X-Amz-Date=20230220T205538Z&X-Amz-SignedHeaders=host&X-Amz-Signature=89c5cc5d28774ddb315f2d421e552d286f7228212f12a49152c7c4d0b034e9f6",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "sample-agreement-template-signature-page-1.pdf",
    "credits": 21,
    "duration": 211,
    "remainingCredits": 96235614
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/delete-text' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-search-and-replace/sample-agreement-template-signature-page-1.pdf",
  "searchStrings": [
    "[CLIENT-NAME]",
    "[CLIENT-COMPANY]",
    "[CLIENT-SIGNATURE]",
    "1 FEB 2023"
  ],
    "replacementLimit": 2,
    "async": false,
    "profiles": "{'\''UsePatch'\'': true, '\''PatchColor'\'': '\''#000000'\''}"
}'

Samples