13–17 -writeText: Adding Text
13–17–1 Processing
Inserts the text to input PDF.
- You can specify the font, color, and transparency of the text. Specify the insertion position from 9 predetermined positions.
- You can specify the page where the text will be inserted. If not specified, the text will be inserted on all pages.
- Specify the page number with 0 origin. Therefore, the first page is counted from "0."
- The text to be inserted can be a "macro text" that replaces dates, file names, page numbers, etc. For details on setting macro text, see 11-5 Macro Text in this manual.
Note:
When running on Linux, the font name setting is required. Specify the font name with "-font -name." When running on Windows, if no font is specified, "MS-Gothic" is specified as the font name in Japanese environments, and "Arial" is specified in other environments.
13–17–2 Example of commands
[Executing example commands]
Inserts the string "Antenna House, Inc." into all pages of test.pdf and outputs it as out.pdf.
- The text is inserted with the following settings and arrangement:
- Font: Meiryo Font (Windows) / IPA Gothic (Linux)
- Font size: 10 points
- Text color: {R G B}={1.0 0.0 0.0}
- Transparency: 0.8
- Placement: Top right
[Windows]
AHPDFToolCmd80.exe -writeText -text "Antenna House, Inc." -align 3 -font -name Meiryo -size 10 -colorText 1.0 0.0 0.0 -opacity 0.8 -d C:\test\test.pdf -o C:\sav\out.pdf
[Linux]
AHPDFToolCmd80 -writeText -text "Antenna House, Inc." -align 3 -font -name ipa-gothic -size 10 -colorText 1.0 0.0 0.0 -opacity 0.8 -d /home/antenna/test/test.pdf -o /home/antenna/sav/out.pdf
13–17–3 Folder settings: applied
You can perform batch processing by specifying the input folder to the -d parameter and the output folder to the -o parameter.
If a folder is specified, the text will be added to the PDF files in the input folder. Note that the output file will be output to the output folder with the same name as the input file name.
13–17–4 Parameters
Parameter
| Content
|
---|
-text Val
| [required] Sets the text to insert. Macro text can also be used for text. For details, see "11-5 Macro Text" in this manual.
|
-pageNo Val
| Sets the page number to insert the text. Can be omitted. Page number is 0 origin. Therefore, the first page is counted from "0." If not specified, it will be inserted on all pages.
|
-vertical
| Specifies the vertical writing. Can be omitted. If specified, writes vertically. If not specified, writes horizontally.
|
-align Val
| Sets the insertion position. Can be omitted. 1: Top left 2: Top center 3: Top right 4: Center left 5: Center 6: Center right 7: Bottom left 8: Bottom center 9: Bottom right If not specified, places at "5: Center." If a value other than 1 to 9 is specified, an error will occur.
|
-angle Val
| Sets the angle of the text. Can be omitted. Effective only for horizontal writing. Counterclockwise is a positive value.
|
-font
| [required] Sets the font (*)
|
| -name Val
| [Required] Font name.
|
| -size Val
| Sets the font size. Can be omitted. Unit: point If not specified, 12 point is applied.
|
| -bold
| If specified, makes the text bold. If not specified, does not make the text bold.
|
| -italic
| If specified, makes the text italic. If not specified, makes the text upright.
|
| -notEmbed
| If specified, does not embed fonts. If not specified, embeds fonts.
|
-colorText r g b
| Sets the fill color of the text. Can be omitted. Setting value range: r, g, b 0.0 to 1.0 for each. If not specified, black (0.0 0.0 0.0) is applied.
|
-colorOutline r g b
| Sets the color of the text outline. Can be omitted. Setting value range: r, g, b, 0.0 to 1.0 for each. If not specified, black (0.0 0.0 0.0) is applied.
|
-opacity Val
| Sets the transparency of the text. Can be omitted. Setting value range: 0.0 to 1.0. 0.0 are transparent, 1.0 is opaque. If not specified, 1.0 (opaque) is applied.
|
(*) For information on obtaining font information and restrictions on Antenna House PDF API Command-line, see "Chapter 5: Handling Fonts" and "Chapter 8: Restrictions - Font Restrictions" in this manual.