Command-line Interface

User Guide / Getting Started

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.

Examples

prince file.xml
Convert file.xml to file.pdf.
prince doc.html -o out.pdf
Convert doc.html to out.pdf.
prince -s style1.css -s style2.css input.xml -o output.pdf
Convert input.xml to output.pdf, applying two user style sheets.
prince doc1.html doc2.html -o out.pdf
Combine doc1.html and doc2.html into a single PDF file, out.pdf.

Specifying input and output

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.

Options

The command line may include the options described below:

General Options

-h, --help
Display usage and options.
--version
Display version information.
-v, --verbose
Log informative messages.
--log=FILE
Log error messages to a file.

Input Options

-i, --input=FORMAT
Set input format [auto | xml | html | html5].
-l, --input-list=FILE
Read input file list from specified file.
--baseurl=URL
Specify the base URL of the input document.
--fileroot=DIR
Specify the root directory for absolute filenames.
--no-xinclude
Disable XInclude processing.

Network Options

--no-network
Disable network access (prevents HTTP downloads).
--http-user=USER
Specify the username for HTTP authentication.
--http-password=PASS
Specify the password for HTTP authentication.
--http-proxy=PROXY
Specify the HTTP proxy server.
--http-timeout=SEC
Specify the HTTP timeout in seconds.
--cookiejar=FILE
Specify a file containing HTTP cookies.
--ssl-cacert=FILE
Specify an SSL certificate file.
--ssl-capath=PATH
Specify an SSL certificate directory.
--insecure
Disable SSL verification (not recommended).

JavaScript Options

--javascript
Enable JavaScript in HTML documents.
--script=FILE
Run an external script.

CSS Options

-s, --style=FILE
Apply a CSS file.
--media=MEDIA
Specify the media type (eg. print, screen).
--no-author-style
Ignore author style sheets.
--no-default-style
Ignore default style sheets.

PDF Output Options

-o, --output=FILE.PDF
Specify the output PDF file.
--profile=PROFILE
Specify the PDF profile to use.
--attach=FILE
Attach a file to the PDF.
--no-artificial-fonts
Disable synthesis of missing bold/italic fonts.
--no-embed-fonts
Disable font embedding in PDF output.
--no-subset-fonts
Disable font subsetting in PDF output.
--no-compress
Disable compression of PDF output.

PDF Metadata Options

--pdf-title=TITLE
Set PDF document title.
--pdf-subject=SUBJECT
Set PDF document subject.
--pdf-author=AUTHOR
Set PDF document author.
--pdf-keywords=KEYWORDS
Set PDF document keywords.
--pdf-creator=CREATOR
Set PDF document creator.

PDF Encryption Options

--encrypt
Encrypt PDF output.
--key-bits=NUM
Set encryption key size [40 | 128].
--user-password=PASS
Set PDF user password.
--owner-password=PASS
Set PDF owner password.
--disallow-print
Disallow printing of PDF output.
--disallow-copy
Disallow copying from PDF output.
--disallow-annotate
Disallow annotation of PDF output.
--disallow-modify
Disallow modification of PDF output.

Utility Options

--scanfonts FILES...
Scan font files and create a CSS file.