Prince may be called from the command-line with the following arguments:
prince OPTIONS
FILES
[-o
PDF]
Please note that on Windows, Prince can be called from the command-line by
running the prince.exe
file found in the
Prince\Engine\bin
folder of the Prince installation.
prince file.xml
file.xml
to
file.pdf
.
prince doc.html
-o out.pdf
doc.html
to
out.pdf
.
prince http://example.com
-o out.pdf
http://example.com
webpage to
out.pdf
.
Note that it is necessary to specify the output file when the input is a
HTTP or HTTPS URL.
prince
-s style1.css
-s style2.css
input.xml
-o output.pdf
input.xml
to
output.pdf
,
applying two user style sheets.
prince
doc1.html
doc2.html
-o out.pdf
doc1.html
and
doc2.html
into a single PDF file,
out.pdf
.
prince doc.html
--raster-output=doc_%d.png
doc.html
and rasterize the output
to the series of files
doc_1.png
,
doc_2.png
,
doc_3.png
etc.
The command-line must contain the name of the input file to process. An input filename consisting of a single hyphen "-" will cause Prince to read from the standard input stream.
The output file name can be specified on the command-line using the
-o
command-line option.
An output filename consisting of a single
hyphen "-" will cause Prince to write to the standard output stream.
If the output file name is omitted, the output will be placed in a file with the same name as the input, but with a PDF file extension.
Any of the --long
command-line options can either be passed
as a single command-line argument with an equals sign (=), or as two
command-line arguments with space:
--output out.pdf
--output=out.pdf
If the value of a command-line option contains a space or other command characters, the value has to be written between quotation marks.
If rasterization is used, the -o
option is optional.
If not specified, a PDF output will not be generated.
The command-line may include the options described below:
-h
, --help
--version
--credits
-v
, --verbose
--debug
--log=FILE
--no-warn-css-unknown
--no-warn-css-unsupported
--no-warn-css
-i FORMAT
,
--input=FORMAT
auto
| xml
|
html
].
-l
,
--input-list=FILE
--baseurl=URL
--remap=URL=DIR
Rather than retrieving documents beginning with
URL
get them from the local directory
DIR
.
This option can be used multiple times to specify more than one remapping.
It cannot be used with --fileroot
.
Note that Prince does not know which file to use when the path maps to a
directory (in other words, an index file).
If http://www.example.com/
is requested, and mapped to
example-com
it does not know whether to open
example-com/index.html
,
example-com/index.php
or any other file
as this is site dependent. In this case Prince will report an error for
that resource.
--fileroot=DIR
--xinclude
--input
command-line option.
--xxe
,
--xml-external-entities
--no-local-files
--no-network
--auth-user=USER
--auth-password=PASS
--auth-server=HOST
[:PORT
]
--auth-scheme=SCHEME
http
or https
--auth-method=METHOD
basic
, digest
, ntlm
and
negotiate
.
The default is basic
.
--auth=URL
SCHEME:
]//USER:PASS@HOST
[:PORT
].
Unlike the preceding
options, --auth
may be used multiple times.
The username and password must be percent-encoded.
--no-auth-preemptive
--http-proxy=PROXY
--http-timeout=SEC
--cookie=COOKIE
Set-Cookie
HTTP header value.
--cookie
may be used multiple times.
--cookiejar=FILE
--ssl-cacert=FILE
--ssl-capath=PATH
--ssl-version=VERSION
default
(let
libcurl
choose), tlsv1
,
tlsv1.0
, tlsv1.1
or tlsv1.2
.
--insecure
--no-parallel-downloads
--javascript
--script=FILE
-s FILE
,
--style=FILE
--media=MEDIA
--page-size=SIZE
size
property in @page
rules, which can take two values for horizontal and vertical dimensions. On the
command-line it needs to be written between quotes as a single argument. See
also Page size and Page Size Keywords.
--page-margin=MARGIN
--no-author-style
--no-default-style
-o FILE.PDF
,
--output=FILE.PDF
--pdf-profile=PROFILE
--pdf-output-intent=ICC
--attach=FILE
--no-artificial-fonts
--no-embed-fonts
--no-subset-fonts
--force-identity-encoding
--no-compress
--convert-colors
--fallback-cmyk-profile=ICC
--pdf-title=TITLE
--pdf-subject=SUBJECT
--pdf-author=AUTHOR
--pdf-keywords=KEYWORDS
--pdf-creator=CREATOR
--pdf-xmp=XMP
--encrypt
--key-bits=NUM
--user-password=PASS
--owner-password=PASS
--disallow-print
--disallow-copy
--disallow-annotate
--disallow-modify
Rasterization is enabled with the --raster-output
option
below.
When this is used the PDF output option (-o
) is optional.
--raster-output=TEMPLATE
Enable raster output.
The output files will be named based on the template.
Prince will replace every
'%
[WIDTH
]d
'
with the current page number.
The optional WIDTH value gives the
number of characters the page number should take within the file name.
Smaller page numbers will be padded to the left with either spaces,
or if the width begins with a zero, with zeros.
For example --raster-output=page_%02d.png
will cause
Prince to generate
page_01.png
,
page_02.png
, …,
page_10.png
,
page_11.png
etc.
Prince also accepts `-
' meaning the standard output
stream.
--raster-format=FORMAT
auto
(guess based on file extension, the default),
png
or jpeg
.
If Prince does not recognize the file extension, or
--raster-output
is '-
',
then it is necessary to provide this option.
--raster-pages=PAGE
all
(the default),
first
and
NUM
(a single page).
--raster-dpi=DPI
--raster-threads=NUM
--raster-background=BACKGROUND
transparent
|
white
]. It can be used when rasterizing to an
image format that supports transparency (PNG, not JPG) and have a
transparent background, so it can be composited with something else
later.
--scanfonts FILES...
--control
The Prince Control Protocol is a synchronous bidirectional protocol that consists of a sequence of "chunks" sent via the standard input and output streams. For more details, please check the detailed documentation in the separate Prince Control Protocol chapter.
--structured-log=LEVEL
The Structured Log option is a formatting option for Prince's output to stderr. For more details, please check the detailed documentation in the separate Structured Log chapter.