# How to replace text in password protected PDF by command line?

In this article, I will show you one method about how to replace text in password protected PDF file by command line. During the replacing process, you even do not open the PDF file. All the process can be done by some simply command lines in a few seconds.  If you have needs of replacing text in PDF by command line, please follow my steps.

• VeryPDF PDF Text Replacer Command Line is an application which can be used to replace specified text in specified positions of pages, with text or images. And we have compressed this command line software into zip file. Once downloading finishes, please extract it some folder then you can check elements in it.
• Before run the conversion, please make sure download the right version as there is also GUI version available. And you’d better read the readme.txt and website carefully, then you can make full of usage of this software.

Step 2. Replace Text in Password Protected PDF File.

• Please run the conversion in compliance with usage and examples.

Usage:pdftr.exe [options] <Input-file> <Output-file>
Examples

• When replace text in normal PDF file, please refer to the following command line.
pdftr.exe -$XXXXXXXXXXXXXXXX -contentreplace "My Name=>Your Name" D:\in.pdf D:\out.pdf -$ <string>: this parameter is an order to input license key to register software
• -contentreplace <string>  : is the order to replace text in page content objects directly

• When replacing text in password protected PDF file, please refer to the following template and add those two parameters:
• -opw <string>   : this parameter should be followed with owner password (for encrypted files)
-upw <string>  : this parameter should be followed with user password (for encrypted files)
pdftr.exe -opw 123 -upw 456 -contentreplace "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf
When you only know the open password, you can try to replace text too as in some conditions this software can replace text in owner password protected PDF file directly. You can check whether the change ability has been disabled or not when PDF is protected by owner password. If the change ability has been not disabled, you can replace text directly without inputting password.

Note: this application and this method is not available for all the PDF file. It is only for text based PDF file. When replace text in image PDF file, this software can not locate text so it can not replace them. Then the replacing process may fail. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]