For protecting PDF content from being changed without permission, we will add password to PDF file. However, when set password for PDF, it will be quite difficult to change content in PDF. Here VeryPDF will share a method of replacing text in PDF by . This method I use shareware tool named VeryPDF PDF Text Replacer Command Line, which can be used to replace specified text in specified positions of pages, with text or images. In the following part, I will show you how to use this software.
- When downloading, please pay attention of the version as there are two versions stated on our website: GUI and version. GUI has most of the functions of command line version but not all.
- When downloading finishes, there will be a zip file. Please extract it to some folder then you can call the executable file in MS Dos Windows.
Step 2. Replace text in password protected PDF file by command line.
- Usage: pdftr.exe [options] <Input-file> <Output-file>
- Now let us check parameters you may use in the replacing process.
- When you need to in PDF, please refer to the following command line template.
-opw <string> : owner password (for encrypted files)
-upw <string> : user password (for encrypted files)
-searchtext <string> : search text in PDF pages and show result to console
-contentreplace <string> : in page content objects directly
-searchandoverlaytext <string>: search and overlay text to PDF pages
pdftr.exe -opw 123 -upw 456 -contentreplace "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf
By this command line, we can in password protected PDF file. And you can replace many texts in one command line. By this mode, the text will be replaced according to the original text font size, style and others.
pdftr.exe -opw 123 -upw 456 -oldtext "Old Text" -newtext "New Text" D:\in.pdf D:\out.pdf
By this command line, we will use another mode to replace text in password word protected PDF file.
pdftr.exe -overlaytextfontname "Arial" -overlaytextcolor FF0000 -overlaybgcolor 00FF00 -searchandoverlaytext "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf
By this command line, we can replace text in password protected PDF file and change text color font, size and style. This is the difference between the first mode and this mode. Please note when you use this software, please make sure that PDF is text based, or replacing may fail.
And when you need to replace text in password protected PDF file, you need to make sure that you have the right to make it, which means you need to know the password. During the using, if you have any question, please contact us as soon as possible.