How to batch replace date strings in PDF pages?

I ran this script for my test file that have date changes for footers on page 2 and the remainder of the document. The footer font Times Roman 10.

I ran this script:

for %F in (C:\Test\*.pdf) do pdftr.exe -overlaytextfontname "Times New Roman" -overlaytextfontsize 10 -overlaybg-y-offset 4 -overlaybgheight 18 -contentreplace "August 19, 2022=>September 9, 2022" "%F" "C:\Test\Output\%~nF_out.pdf"

It change the date from August 19, 2022 to September 9, 2022 in the footers on page 3 and beyond, but did not change the August date on page 2.

Attached is the test input pdf file. The next msg will include the result pdf file.

Here is the command line execution results below:

C:\PDF Tool\pdftextreplacer_cmd>for %F in (C:\Test\*.pdf) do pdftr.exe -overlaytextfontname "Times New Roman" -overlaytextfontsize 10 -overlaybg-y-offset 4 -overlaybgheight 18 -contentreplace "August 19, 2022=>September 9, 2022" "%F" "C:\Test\Output\%~nF_out.pdf"

C:\PDF Tool\pdftextreplacer_cmd>pdftr.exe -overlaytextfontname "Times New Roman" -overlaytextfontsize 10 -overlaybg-y-offset 4 -overlaybgheight 18 -contentreplace "August 19, 2022=>September 9, 2022" "C:\Test\Test1-Original.pdf" "C:\Test\Output\Test1-Original_out.pdf"
[Message] Working in "Evaluation" mode1.
[Message] Trial version has some restrictions, please purchase full version to remove the restrictions.
[Message] You have 138 times to evaluate this software, you may purchase a full version from "http://www.verypdf.com" web site.
[Message] Working in "Evaluation" mode.
[Message] Try to replace text in page contents...
[ReplaceText] August 19, 2022=>September 9, 2022
[ContentParserExport] Processing page 1 of 4...
[ContentParserExport] Processing page 2 of 4...
[ContentParserExport] Processing page 3 of 4...
[OK, Found and Replaced] 'August 19, 2022'=>'September 9, 2022'
[Not Found in] 'Page '
[ContentParserExport] Processing page 4 of 4...
[OK, Found and Replaced] 'August 19, 2022'=>'September 9, 2022'
[Not Found in] 'Page '
[Message] Replaced '2' keywords.
[Message] Create "C:\Test\Output\Test1-Original_out.pdf" file successful.

Thank you,
Customer

---------------------------------------------------------

VeryPDF PDF Text Replacer Command Line (pdftr.exe),

https://www.verypdf.com/app/pdf-text-replacer/search-and-replace-pdf-text-command-line.html

https://www.verypdf.com/app/pdf-text-replacer/try-and-buy.html#buy-cmd

image

From log message, the page 1 and page 2 are not contain "August 19, 2022" keyword, software will show "[OK, Found and Replaced]" for each found keyword, it only found keyword on page 3 and page 4,

--------------------------
[ReplaceText] August 19, 2022=>September 9, 2022
[ContentParserExport] Processing page 1 of 4...
[ContentParserExport] Processing page 2 of 4...
[ContentParserExport] Processing page 3 of 4...
[Message] Output to "C:\Users\Dlehman\AppData\Local\Temp\vpdf-86520-1661262381-3599-3.txt" file.
[OK, Found and Replaced] 'August 19, 2022'=>'September 9, 2022'
[Not Found in] 'Page '
[ContentParserExport] Processing page 4 of 4...
[Message] Output to "C:\Users\Dlehman\AppData\Local\Temp\vpdf-86520-1661262381-3104-4.txt" file.
[OK, Found and Replaced] 'August 19, 2022'=>'September 9, 2022'
[Not Found in] 'Page '
[Message] Replaced '2' keywords.
[Message] Create "C:\Test\Output\Test1-Original_out.pdf" file successful.
--------------------------

You may use "-listtext" parameter to check what text included in page 1 and page 2, for example,

pdftr.exe -listtext D:\Downloads\Test_Doc_with_dates.pdf
===== Search keyword in page 1 =====
[95.86, 161.43, 104.15, 177.62] 'August 19, 2022'
[72.00, 744.84, 79.22, 758.31] 'August 19, 2022'
[513.06, 744.84, 518.62, 758.31] 'Page 1'
===== Search keyword in page 2 =====
[152.83, 204.18, 159.50, 217.83] 'August 19, 2022'
[72.00, 744.84, 79.22, 758.31] 'August 19, 2022'
[513.06, 744.84, 518.62, 758.31] 'Page 2'

If you still can't get it work, please send to us your new PDF file and your Order ID for pdftr.exe, we will work on this problem and figure out a solution to you asap.

VeryPDF
---------------------------------------------------------
btw, I noticed you are using "-contentreplace" parameter, please change it to "-searchandoverlaytext" to try again, for example,

pdftr.exe -overlaytextfontname "Times New Roman" -overlaytextfontsize 10 -overlaybg-y-offset 4 -overlaybgheight 18 -searchandoverlaytext "August 19, 2022=>September 9, 2022" "C:\Test\Test1-Original.pdf" "C:\Test\Output\Test1-Original_out.pdf"

Can you get it work fine with "-searchandoverlaytext" parameter?

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!