# How to replace text contents in PDF page?

I am very interested in the PDF Text Replacer. I have downloaded and installed the demo, and I have tried to replace text in my files. It seems strings are recognized as text objects (showing the boxes), but I am not able to replace the text using "According to content". Could you take a look with the attached file (as you can see, I am also testing the stamping tool)?

Furthermore, I would like to use the command line version. It is installed, but there is no user guide for that. Do you have something you can share?

Customer
---------------------------------------------------------
Thanks for leaving a message for us.

Here is the user guide of command line version, please have a check.

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

If you still can not make it work, please tell us which font do you need to replace and show me the problem PDF file then we can make it for you and tell you detail steps.

VeryPDF
---------------------------------------------------------
I have tried to replace a text in the attached pdf, using the following command line:

C:\Program Files (x86)\VeryPDF PDF Text Replacer>replace -mode 1 -oldtext "Omschrijving:" -newtext "Description:" d:\00057.pdf d:\00057_desc.pdf

The new file is created, the text is not replaced.

Q: Can you tell me why the text is not replaced? I have the same problem with the version with the interface.

Customer
---------------------------------------------------------
I have tried to replace a text in the attached pdf, using the following command line:

C:\Program Files (x86)\VeryPDF PDF Text Replacer>replace -mode 1 -oldtext Omschrijving: -newtext Description: d:\00057.pdf d:\00057_desc.pdf

The new file is created, the text is not replaced.

Q: Can you tell me why the text is not replaced? I have the same problem with the version with the interface.

Customer
---------------------------------------------------------
We have a standalone version of PDF Text Replacer Command Line software, you download trial version from following web page,

http://www.verypdf.com/wordpress/201303/verypdf-releases-pdf-text-replacer-command-line-software-35653.html

http://www.verypdf.com/dl2.php/pdftextreplacer_cmd.zip

However, because the pages in your sample PDF file have been rotated, PDF Text Replacer Command Line doesn't support rotated PDF pages properly, so it can't replace text in your PDF file, we will fix this problem in the next version of PDF Text Replacer Command Line application.

VeryPDF
---------------------------------------------------------
Thanks for your reply. I have done some further review on new data, and to me the problem is not that the PDF has been rotated (maybe I have send you the wrong example, sorry), but that some fonts are not recognized. I have added some examples. With -contentreplace some fonts are all right (see "TUBE PRECISION GEL 20 x 2" in 0009737), with "-searchandoverlay" all fonts seem to be all right (see "Description" in 0009737). But I do not want to give font height for all separate text to be replaced.

Q: Why is some text not recognized?
Q: Is my assumption right that it has to do with the font?
Q: Can we fix this easily?

Customer
---------------------------------------------------------
>>Q: Why is some text not recognized?

Because some text are render using embedded fonts, they are not the real characters in PDF file contents, pdftr.exe can't using text match arithmetic to locate this text string, so it will not able to find the text by "-contentreplace" parameter. In order to solve this problem, you need use "-searchandoverlay" option, because "-searchandoverlay" option has a more powerful text search arithmetic. It can search or locate the text from any type of PDF files.

>>Q: Is my assumption right that it has to do with the font?
>>Q: Can we fix this easily?

This can't be fixed easily.

At the moment, you can use "-searchandoverlaytext" option to replace the text contents if "-contentreplace" option is unable to locate text in your PDF file, you can run following command line to replace text correctly,

The output PDF file is look fine, please look at following screenshot, left is original PDF page contents, right is the replaced PDF page contents, as you see, they are almost no difference,

When you use "-searchandoverlaytext" option, you can specify the font name and font size, like I do in above command line.

If you prefer to get "-contentreplace" option to work, we can provide a new custom-build version to you. But there has an important issue with "-contentreplace" option , if this embedded font hasn't special characters, for example, we assume this embedded font is not contain "Desc" four characters, when you run following command line,

you will unable to see "Desc" in replaced page contents, you will only see "    ription:" characters, this is a limitation of "-contentreplace" option, because "-contentreplace" option is using embedded fonts to show the characters, it can't show the characters which not included in embedded fonts. But "-searchandoverlaytext" option will use System Fonts to show the characters, it can show all characters, please understand their difference.

"-contentreplace" option will show text with embedded fonts (or subset fonts), it may not show all characters properly. You needn't worry about font size and font name by this option. pdftr.exe will use original font name, font size and font color automatically.

"-searchandoverlaytext" option will show text with Windows System Fonts, it can show all characters, but you need set the font size, font name or font color by manual in some case.

VeryPDF

VN:F [1.9.20_1166]
VN:F [1.9.20_1166]

## Related Posts

This entry was posted in PDF Text Replacer and tagged , . Bookmark the permalink.