40
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
57
-o output\1_hf.pdf
(“output” folder is in the current working folder)
-o output
(“output” folder is in the current working folder)
c)
Operation Mode (-mode)
The operation mode argument (-mode) is required in the command line, which is used to specify the
mode to process header/footer. For more details about this argument, please refer to section 3.4.2
“Command Line Summary”.
d)
XML Configuration File (-conf)
The XML configuration file argument (-conf) is required in the command line when the argument (-
mode) is set to 1 or 2. The configuration file contains the setting information of header/footer, which
is generated by the built-in Foxit Configuration Tool (fpdfhfconf.exe or fpdfhfconf64.exe). For more
details about header/footer settings, please refer to section 4.2.1 “Header/Footer Settings”. Users
should input a path of an XML file. For example:
-conf c:\conf_hf.xml
It also supports relative paths if the specified XML configuration file is in the current working folder.
Users can input just the name of the XML file, instead of an absolute path. For example:
-conf conf_hf.xml
(conf_hf.xml is in the current working folder)
Usage Examples
1)
Add a new header/footer into PDF files (-mode 1 -conf conf_hf.xml )
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 1 -conf c:\conf_hf.xml
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml
fpdfhf -i test -o output -mode 1 -conf conf_hf.xml
2)
Replace the header/footer in PDF files (-mode 2 -conf conf_hf.xml )
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 2 -conf c:\conf_hf.xml
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 2 -conf c:\conf_hf.xml
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml
3)
Remove the header/footer in PDF files (-mode 3)
35
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
58
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 3
fpdfhf -i test -o output -mode 3
3.4.3.2
Overlay
The optional argument (-overlay) is used to overlay an existing header/footer in PDF file. It is valid
only when the argument (-mode) is set to 1 and the PDF file already contains a header/footer.
Usage Example
1)
Overlay an existing header/footer in PDF file. (-overlay)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 1 -conf c:\conf_hf.xml -overlay
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -overlay
fpdfhf -i test -o output -mode 1 -conf conf_hf.xml -overlay
3.4.3.3
Open Password
The optional argument (-op) indicates the open password for a password-protected input PDF file. It
is not required if the input file is not password protected.
Note The output PDF file will retain the open password from the input file.
Usage Example
1)
Specify the open password for a password-protected input PDF file (-op 123)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 1 -conf c:\conf_hf.xml -op 123
fpdfhf -i test\2.pdf -o output\2_hf.pdf -mode 2 -conf conf_hf.xml -op 123
fpdfhf -i test\3.pdf -o output\3_hf.pdf -mode 3 -op 123
2)
Specify the open password for all input PDF files that have been protected with the same password (-
op 123)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -op 123
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -op 123
fpdfhf -i test -o output -mode 3 -op 123
37
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
59
Note It only supports typing one value for the argument (-op). Only files with the same open
password can be processed together and files with different open password need to be processed
separately.
3.4.3.4
Document Metadata Settings
a)
Title (-title)
The optional argument (-title) is used to set title of PDF files.
Usage Example
1)
Set document title to “Foxit PDF Toolkit User Manual” (-title “Foxit PDF Toolkit User Manual”)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3 -title “Foxit PDF Toolkit User Manual”
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -title “Foxit PDF Toolkit User Manual”
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml -title “Foxit PDF Toolkit User
Manual”
b)
Subject (-subject)
The optional argument (-subject) is used to set subject of PDF files.
Usage Example
1)
Set document subject to “Foxit PDF Toolkit” (-subject “Foxit PDF Toolkit”)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3 -subject “Foxit PDF Toolkit”
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -subject “Foxit PDF Toolkit”
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml -subject “Foxit PDF Toolkit”
c)
Keywords (-keywords)
The optional argument (-keywords) is used to set keywords of PDF files.
Usage Example
1)
Set document keywords to “toolkit” (-keywords “toolkit”)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3 -keywords “toolkit”
37
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
60
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -keywords “toolkit”
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml -keywords “toolkit”
d)
Author (-author)
The optional argument (-author) is used to set author of PDF files.
Usage Example
1)
Set document author to “Jessie” (-author “Jessie”)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3 -author “Jessie”
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -author “Jessie”
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml -author “Jessie”
e)
Creator (-creator)
The optional argument (-creator) is used to set file creation application information of PDF files.
Usage Example
1)
Set document creator to “Foxit Reader” (-creator “Foxit Reader”)
fpdfhf -i c:\input\1.pdf -o d:\output\1_hf.pdf -mode 3 -creator “Foxit Reader”
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -creator “Foxit Reader”
fpdfhf -i “c:\input\*.pdf” -o d:\output -mode 1 -conf c:\conf_hf.xml -creator “Foxit Reader”
3.4.3.5
Recursion Depth of Sub-folders
The optional argument (-r) indicates the recursion depth of sub-folders, which is valid only when the
input is a folder or a path that includes wildcard characters like “c:\input\*.pdf”. y default, the
recursion depth is 1, so the sub-folders will not be processed. For more details about this argument,
please refer to section 3.4.2 “Command Line Summary”.
Usage Examples
1)
Search the full folders (-r or -r 0)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -r
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -r
34
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
61
fpdfhf -i test -o output -mode 3 -r
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -r 0
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -r 0
fpdfhf -i test -o output -mode 3 -r 0
2)
Search only the current folder (-r 1)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -r 1
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -r 1
fpdfhf -i test -o output -mode 3 -r 1
Note If you don’t use this argument, the current folder will be searched by default. For example:
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml
fpdfhf -i test -o output -mode 3
3)
Search the current folder and its sub-folders (-r 2)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -r 2
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -r 2
fpdfhf -i test -o output -mode 3 -r 2
3.4.3.6
Multi-thread Support
The optional argument (-t) indicates the number of threads that are used to speed up batch
programming by making full use of the CPU. By default, the number of the threads is 1.
Note It is recommended that you set the value of the number according to your computer’s CPU
configuration.
Usage Example
1)
Set the number of threads to 3 (-t 3)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -t 3
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -t 3
fpdfhf -i test -o output -mode 3 -t 3
39
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
62
3.4.3.7
Other Optional Arguments
a)
Log file (-log<logfile> -l<log level>)
The optional argument (-log) indicates the path of logfile, where the log message is placed. The
argument (-l) indicates the log level. It is valid only when (-log) is used. By default, the log level is 4.
For more details about this argument, please refer to section 3.4.2 “Command Line Summary”.
Usage Example
1)
Save the log file to “d:\output\hf.log” and set the log level to 3 (-log d:\output\hf.log -l 3)
fpdfhf -i c:\input -o d:\output -mode 1 -conf c:\conf_hf.xml -log d:\output\hf.log -l 3
fpdfhf -i test -o output -mode 2 -conf conf_hf.xml -log d:\output\hf.log -l 3
fpdfhf -i test -o output -mode 3 -log d:\output\hf.log -l 3
b)
Register information (-register <code> <licensee>)
The optional argument (-register) is used to register the command line tool. The <code> is the
activation code from Foxit and <licensee> is the licensee name designated by the users.
Usage Example
4)
Register the pdfheaderfooter tool with the code “77505-010G0-G1000-XMQ8D-2CR7R-TP EI” and
the licensee “Foxit” (-register 77505-010G0-G1000-XMQ8D-2CR7R-TPBEI Foixt)
fpdfhf -register 77505-010G0-G1000-XMQ8D-2CR7R-TPBEI Foixt
c)
License agreement (-license)
The optional argument (-license) is used to print the license agreement.
Usage Example
1)
Print the license information (-license)
fpdfhf -license
d)
Version information (-version/-v)
The optional argument (-version/-v) is used to print the version information.
17
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
63
Usage Example
1)
Print the version information (-version/-v)
fpdfhf -version
fpdfhf -v
e)
Help information (-help/-h)
The optional argument (-help/-h) is used to print the usage information.
Usage Example
1)
Print the usage information (-help/-h)
fpdfhf -help
fpdfhf -h
53
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
64
3.5
PDFOptimizer
3.5.1
Basic Syntax
fpdfopt <-i <srcfile/srcfolder>> <-o <destfile/destfolder>> [-dc <algorithm> [DPIAbove] [DPISet]]
[-cc <algorithm> <level> [blocksize]] [-dm <algorithm> [DPIAbove] [DPISet]] [-cm <algorithm> [level]]
[-rd] [-u] [-d <intlist>] [-cl <intlist>] [-op <password>]
[-r [recursion]] [-t <thread>] [-log <logfile>] [-l <level>]
fpdfopt -register <code> <licensee>
fpdfopt -license
fpdfopt -version/-v
fpdfopt -help/-h
Note:
<> required
[ ] optional
/ mutually exclusive
A space is needed between the command line argument and the value
Only the <-i <srcfile/srcfolder>> and <-o <destfile/destfolder>> arguments are actually required. All others are
optional, which are available for controlling the output PDF files as desired. The arguments could be given in
any order. Full details on each are explained in the following section.
3.5.2
Command Line Summary
Note For some arguments whose values are strings, users can choose whether to add quotation marks (“ ”)
to the strings. In the manual we have added notes where adding quotation marks (“ ”) is required.
Option
Parameter
Description
-i
<-i <string>>
e.g.
-i C:\input\1.pdf
pdf
-i c:\input
Specifies the input file to be optimized.
The input string can be the name of a single PDF
PDF
file or a folder.
The file name can contain the wildcard
character (*). For example, use *.pdf to include
all PDF files in a given folder.
Note Wildcard character (*.*) is currently not
not
supported.
95
Foxit PDF Toolkit User Manual
www.foxitsoftware.com
65
Option
Parameter
Description
-o
<-o <string>>
>
e.g.
-o D:\output\1_opt.pdf
.pdf
-o D:\output
Specifies the path of the output PDF file or folder.
If the input is a PDF file, the output should be a
single PDF file, (e.g. -o D:\output\1_opt.pdf).
f).
If the input is a folder, the output should be a
folder, (e.g. -o D:\output).
).
Note The specified output path must already exist.
-dc
[-dc <string> [integer]
]
[integer]]
-dc <algorithm> [DPIAbove]
[DPISet]
e.g.
-dc a 225 150
-dc s 225 150
-dc b 225 150
-dc a
-dc s
-dc b
Downsamples color/grayscale images.
<algorithm> : Chooses downsampling
algorithms
a: Average Downsampling
s: SubSampling
b: Bicubic Downsampling
[DPIAbove]: DPI threshold value. Images with a
h a
DPI higher than this value will be downsampled.
Default value: 225. Allowable range: DPISet-
-
DPISet*10
[DPISet]: Target DPI value images will be
e
downsampled to if their DPI is above the
threshold. Default value: 150. Allowable range:
9-2400.
Note
The DPIAbove and DPISet must be set at the
the
same time.
If the argument (-dc) is not set, images will not
t
be downsampled.
-cc
[-cc <string> <string>
[integer]]
-cc <algorithm> <level>
[blocksize]
e.g.
-cc j min
-cc j low
-cc j medium
-cc j high
-cc j max
Compresses color/grayscale images.
<algorithm>: Chooses compression algorithm.
thm.
j: JPEG
G
j2: JPEG2000
0
<level>: Chooses quality level. Allowable levels
vels
are min, low, medium, high and max.
.
[blocksize]: Chooses block size for JPEG2000
0
algorithm only. Default value: 256. Allowable
values: 128-2048.
Documents you may be interested
Documents you may be interested