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 PDF.co built-in files storage. To upload files via API, Check out the Files Upload section.

Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf)

For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.
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 a 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
Set the expiration time for the output link in minutes (default is 60 i.e 60 minutes or 1 hour), After this specified duration, any generated output file(s) will be automatically deleted from PDF.co temporary files storage. The maximum duration for link expiration varies based on your current subscription plan. Learn more

To store permanent input files (e.g. re-usable images, pdf templates, documents), Consider using PDF.co built-in Files Storage.
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
Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish.
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 PDF.co built-in files storage. To upload files via API, Check out the Files Upload section.

Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf)

For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.
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 a 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
Set the expiration time for the output link in minutes (default is 60 i.e 60 minutes or 1 hour), After this specified duration, any generated output file(s) will be automatically deleted from PDF.co temporary files storage. The maximum duration for link expiration varies based on your current subscription plan. Learn more

To store permanent input files (e.g. re-usable images, pdf templates, documents), Consider using PDF.co built-in Files Storage.
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
Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish.
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 PDF.co built-in files storage. To upload files via API, Check out the Files Upload section.

Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf)

For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.
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
Set the expiration time for the output link in minutes (default is 60 i.e 60 minutes or 1 hour), After this specified duration, any generated output file(s) will be automatically deleted from PDF.co temporary files storage. The maximum duration for link expiration varies based on your current subscription plan. Learn more

To store permanent input files (e.g. re-usable images, pdf templates, documents), Consider using PDF.co built-in Files Storage.
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
Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish.
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