In this article, I will show you how to add background color for text in PDF by command line. This function can be used to emphasize or highlight some text in PDF. If you use Adobe Reader, you can not add background for text in PDF in batch, say you want to add background color for text like VeryPDF in a 100 pages PDF file, you need to make it one by one in Adobe Reader. But here I will show you how to add background for all VeryPDF in a 100 pages PDF file.
I use software PDF Text Replacer Command Line version, which is a professional tool for replacing text in PDF. But it can also be used to add background for text in PDF. In the following part, I will show you how to make it work.
Step 1. Download PDF Text Replacer Command Line
- If you are not familiar with command line version software, please use the GUI version.
- When downloading finishes, please unzip it to the format of folder. Then you will find executable file, readme.txt and some bat examples which allows you to check working effect by simply clicking.
Step 2. Add background color for text in PDF by command line.
- When you run conversion, please obey rules of this software.
- Usage: pdftr.exe [options] <Input-file> <Output-file>
- When you add background color for text in PDF, please refer to the usage and examples.
- You can also use this software like the following command line template. By it, you can change text content, name, style, size, color and others.
pdftr.exe -searchandoverlaytext "M&C=>M&C" -overlaybgcolor 00FF00 test1.pdf te1234567.pdf
When input the command line, please call executable file, input the font you need to add background and then mark the font color. At last, please input the full path of input PDF and output PDF.
Now let us check adding background effect from the following snapshot.
pdftr.exe -searchandoverlaytext "PDFcamp Printer=>VeryPDF Printer" -overlaytextfontname "Verdana" -overlaytextfontsize 80%% -overlaytextcolor FF0000 -overlaybgcolor 00FF00 verypdf.pdf _textoverlay_PDFcampPrinter_VeryPDFPrinter.pdf
Now let us check some color values for your reference.
Red#FF0000 White#FFFFFF Cyan#00FFFF Silver#C0C0C0 Blue#0000FF Gray or Grey#808080 DarkBlue#0000A0
Black#000000 LightBlue#ADD8E6 Orange#FFA500 Purple#800080 Brown#A52A2A Yellow#FFFF00
Maroon#800000 Lime#00FF00 Green#008000 Magenta#FF00FF Olive#808000
Now let us check related parameters:
-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
By this software, we can add background to text in PDF. During the using, if you have any question, please contact us as soon as possible.