VeryPDF PDF Text Replacer can replace PDF text with text and image, which now supports command line operation, which can search and replace text with text or image by command line. This article shows you how to search and replace PDF text by command line.
1. Download and install | 2. Replace text with text | ||
---|---|---|---|
3. Replace text with image | 4. All command line options | ||
5. PDF Text Replacer Command Line Standalone Version (pdftr.exe) |
VeryPDF PDF Text Replacer is try-before-use and you may download and install it for free. After install the application, you will see the command line program, replace.exe, in the installation directory of the application. Open a command prompt window and you will be able to run the command line program.
The following command line can be used for searching and replacing text with text.
replace in.pdf out.pdf -mode 1 -oldtext Daily -newtext Monthly
With the command line, the program, replace, searches the text Daily in input PDF file in.pdf, and then replace the text with Monthly. The output PDF file with text replaced will be saved as out.pdf. Option -mode 1 tells program to replace with text, -oldtext specifies the text to be replaced, and -newtext specifies the text to replace with.
To search and replace text with image, you may use the following command line.
replace.exe in.pdf out.pdf -mode 2 -oldtext Daily -image day.png
The program follows the commands and replaces the text Daily with image day.png. Option -mode 2 switches the program to replace text with image, and -image specifies the image to replace with. It supports image formats of BMP, GIF, TIFF, JPEG and PNG.
The program can set the width and height of image when replace with image as in the following command line.
replace.exe in.pdf out.pdf -mode 2 -oldtext Daily -image day.png -imgwidth 80 -imgheight 40
In the command line, option -imgwidth 80 sets the image width to 80 pixels, and -imgheight sets the image height to 40 pixels.
Run the program without any argument or option like the following,
replace.exe
And then the command prompt window will display the option description of the program as the followings.
-mode <int> : Replace mode. 1 : Replace with text. 2 : Replace with image. -oldtext <string> : Specify text to replace. -newtext <string> : Specify text to replace with. -image <string> : Specify image to replace with. Support BMP, GIF, JPEG, PNG and TIFF. -imgwidth <int> : Set width for the new image, unit: pixel. -imgheight <int> : Set height for the new image, unit: pixel. -$ <string> : Register the program.
VeryPDF has a standalone version of PDF Text Replacer Command Line application (pdftr.exe), this standalone version of PDF Text Replacer Command Line has more functions than "replace.exe" which included in PDF Text Replacer GUI application.
Release Note for standalone version of PDF Text Replacer Command Line (pdftr.exe).
Download and Evaluate PDF Text Replacer Command Line (pdftr.exe) standalone version.
Purchase PDF Text Replacer Command Line (pdftr.exe) standalone version.
Refer to more articles for PDF Text Replacer Command Line (pdftr.exe) application.
Command Line options in PDF Text Replacer Command Line application (pdftr.exe),
C:\>E:\pdftextreplacer_cmd\pdftr.exe Web: http://www.verypdf.com Email: support@verypdf.com VeryPDF PDF Text Replacer Command Line v3.0 Batch replace or overlay text with text or image to PDF pages. =========================================== Support input format: 1. PDF: Adobe Acrobat PDF file format Support output format: 1. PDF: Adobe Acrobat PDF file format =========================================== Usage: pdftr.exe [options] <Input-file> <Output-file> -pagerange <string> : set page range for search keywords, e.g., 1,3-5,7,9- -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 -uncompress : uncompress the PDF file -contentreplace <string> : replace text in page content objects directly -searchandoverlaytext <string>: search and overlay text to PDF pages -overlaytextfontname <string> : set overlay text fontname, default is 'Arial' -overlaytextfontsize <string> : set overlay text font size, default is 0 for auto -overlaytextcolor <string> : set overlay text color, in Hex, default is 000000 -overlaybgcolor <string> : set overlay text background color, in Hex, default is FFFFFF -oldtext <string> : specify text to replace -newtext <string> : specify text to replace with -image <string> : specify image to replace with, support JPEG, PNG and TIFF -imgwidth <int> : set width for the new image, unit: pixel, default is 0 for auto, -1 for full image width -imgheight <int> : set height for the new image, unit: pixel, default is 0 for auto, -1 for full image height -skip : don't overwrite an output file if it already exists -h : print usage information -help : print usage information --help : print usage information -? : print usage information -$ <string> : input your license key Examples: pdftr.exe -$ XXXXXXXXXXXXXXXX pdftr.exe -uncompress D:\in.pdf D:\out.pdf pdftr.exe -$ XXXXXXXXXXXXXXXX -contentreplace "My Name=>Your Name" D:\in.pdf D:\out.pdf pdftr.exe -contentreplace "My Name=>Your Name" D:\in.pdf D:\out.pdf pdftr.exe -searchandoverlaytext "My Name=>Your Name" D:\in.pdf D:\out.pdf pdftr.exe -searchandoverlaytext "My Name=><IMAGE>D:\temp\myname.png*20*20" D:\in.pdf D:\out.pdf pdftr.exe -pagerange 1-3 -contentreplace "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf pdftr.exe -searchtext "string" C:\in.pdf pdftr.exe -pagerange 1 -searchtext "string" C:\in.pdf pdftr.exe -pagerange 1 -searchandoverlaytext "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf 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 pdftr.exe -opw 123 -upw 456 -contentreplace "Old Text=>New Text||VeryPDF=>VeryDOC||My Name=>Your Name" D:\in.pdf D:\out.pdf pdftr.exe -searchandoverlaytext "PDFcamp Printer=>VeryPDF Printer" -overlaytextfontsize 8 D:\in.pdf D:\out.pdf pdftr.exe -searchandoverlaytext "PDFcamp Printer=>VeryPDF Printer" -overlaytextfontsize 80% D:\in.pdf D:\out.pdf pdftr.exe -oldtext "Old Text" -newtext "New Text" D:\in.pdf D:\out.pdf pdftr.exe -oldtext "Old Text" -image D:\test.png D:\in.pdf D:\out.pdf pdftr.exe -oldtext "Old Text" -image D:\test.png -imgwidth 20 -imgheight 50 D:\in.pdf D:\out.pdf pdftr.exe -oldtext "Old Text" -image D:\test.png -imgwidth -1 -imgheight -1 D:\in.pdf D:\out.pdf pdftr.exe -oldtext "Old Text" -image D:\test.png -imgwidth 0 -imgheight 0 D:\in.pdf D:\out.pdf Batch process examples: for %F in (D:\temp\*.pdf) do pdftr.exe -contentreplace "My Name=>Your Name" "%F" "out_%~nF.pdf" for %F in (D:\temp\*.pdf) do pdftr.exe -searchandoverlaytext "My Name=>Your Name" "%F" "C:\test\%~nF.pdf" for %F in (D:\temp\*.pdf) do pdftr.exe -skip "%F" "C:\test\%~nF.pdf" for /r D:\temp %F in (*.pdf) do pdftr.exe -oldtext "Old Text" -newtext "New Text" "%F" "C:\test\%~nF.pdf"