Prince
  • Buy Prince
  • Samples
  • Documentation
  • Forum
  • Download
  • Installation Guide
  • User Guide
  • Reference Guide

Contents

  • 1. Getting Started
    • Installing Prince
      • Installing Prince on Windows
      • Installing Prince on MacOS X
      • Installing Prince on Linux
        • Debian and Ubuntu
        • Redhat and CentOS
        • OpenSUSE
        • FreeBSD, Solaris and Generic Linux
      • Installing a license file
      • Installation Layout
        • Windows installation layout
        • MacOS X installation layout
        • Linux installation layout
    • Your First Document
      • The lab report
      • Processing the document
      • Styling the document
  • 2. Styling
    • Fonts
      • Defining a font family
      • Generic font families
      • OpenType Features in Prince
      • Redefining the generic font families
    • Layout
      • Text formatting
      • Paragraph formatting
      • Writing Mode
      • CSS Box Model
        • Margin
        • Padding
        • Border
        • Background
      • Tables
        • Automatic table layout
        • Fixed table layout
        • Separated table borders
        • Collapsing table borders
        • Cells that span columns
        • Cells that span rows
        • Numbering table rows
        • Running table headers and footers
        • Table captions
      • Lists
        • List marker position
        • List marker type
        • List marker style
      • Columns
      • Floats
        • Prince extensions to floats
      • Footnotes
        • Footnote calls
        • Footnote markers
        • Styling footnotes
    • Paged Media
      • Page size
      • Page style
      • Trimming marks
      • Page regions
        • Generated content in page regions
      • Selecting pages
        • Blank pages
      • Controlling pagination
        • Page breaks
        • Widows and orphans
  • 3. Scripting
    • JavaScript in Printed Media
    • Logging
    • Console access
    • Event handling
    • Document statistics
    • PDF properties
    • Unsupported DOM properties
  • 4. Graphics
    • Color
      • RGB
      • RGBA
      • CMYK
      • Spot colors
    • Color Management
      • Introduction
      • Color Management and PDF Profiles
      • Color Management in Prince
      • Color conversion
      • Rich black and true black
      • Page color space
    • Filters
    • Images
      • Images in XHTML
      • Images in DocBook
      • Images in Arbitrary XML
      • CSS and Images
        • Image Size in Print
    • Scalable Vector Graphics (SVG)
      • Viewbox and viewport
      • Rectangles
      • Circles
      • Ellipses
      • Lines
      • Masks
      • Polylines
      • Polygons
      • Paths
      • Text
      • Images
      • Links
      • Transformations
      • Style Properties
    • Rasterization
  • 5. Prince Tips and Tricks
    • Generated Content
      • Page headers and footers
      • List markers
      • Footnote markers
      • Before and After pseudo-elements
      • Counters and Numbering
        • Counter reset and increment
        • Nested counters
        • Counter styles
      • Cross-references
        • Using target-counter
        • Using target-content
      • Script Functions
        • Accessing the current date and time
        • User-defined counter styles
      • Using generated content in page regions
      • Copying text content from the document
      • Taking elements from the document
    • Advanced paged media examples
      • Named pages
      • Page groups
      • Page breaks and decoration
      • Printing wide content sideways
    • Hyphenation
    • Typographic Ligatures
    • Watermarks
    • Rotating content in table cells
    • The "Two-Pass" Solution
  • 6. Help
    • Troubleshooting
      • Missing glyphs or fonts
      • Fontconfig
      • Image formats
      • Shared library trouble
      • PATH issues
      • The capture/replay system
      • Running the debug script
    • Frequently Asked Questions
  • 7. Prince Input
    • Applying Style Sheets in Prince
      • Importing Style Sheets
      • Conflicting Declarations
      • Priority Determination
    • Applying JavaScript in Prince
    • XML Input
      • XML Input
        • Validation
        • xml:lang
        • xml:id
        • xml:base
      • XML Styling
      • XML Inclusions (XInclude)
        • Including XML files
        • Including text files
        • Fallback
  • 8. Prince Output
    • PDF Profiles
      • PDF/A
      • PDF/X
    • PDF Output Options
      • PDF Links
      • PDF Actions
      • PDF Pages
      • PDF Printing
      • PDF Compression
      • Font Embedding
      • Creating PostScript output
    • PDF Bookmarks
      • Bookmark levels
      • Bookmark labels
      • Bookmark targets
    • PDF Metadata
      • XMP Metadata
  • 9. Server Integration
    • Security and performance
    • Prince Wrappers
      • Third-Party Wrappers
      • Using Prince from Java
      • Using Prince from .NET with C#
      • Using Prince from .NET with VB.NET
      • Using Prince from Python
      • Using Prince from Perl
      • Using Prince from PHP
      • Using Prince from ASP
      • Using Prince from ColdFusion
      • Using Java
      • Using ActiveX/COM
      • Using Prince from ActiveX / COM / Visual Basic
    • Advanced Command Line Options
      • Prince Control Protocol
      • Structured Log

Reference Guide

  • A1. Command-line Reference
    • Examples
    • Specifying input and output
    • Options
      • General Options
      • Logging Options
      • Input Options
      • Network Options
      • JavaScript Options
      • CSS Options
      • PDF Output Options
      • PDF Metadata Options
      • PDF Encryption Options
      • Raster Output Options
      • Utility Options
      • Advanced Control and Log Options
  • A2. CSS References
    • CSS Features
    • Length Units
      • Absolute Length Units
      • Font Length Units
      • Pixel Unit
  • A3. CSS Properties
    • alternate-color
    • background
    • background-attachment
    • background-clip
    • background-color
    • background-image
    • background-origin
    • background-position
    • background-repeat
    • background-size
    • baseline-shift
    • border
    • border-bottom
    • border-bottom-color
    • border-bottom-left-radius
    • border-bottom-right-radius
    • border-bottom-style
    • border-bottom-width
    • border-clip
    • border-collapse
    • border-color
    • border-left
    • border-left-color
    • border-left-style
    • border-left-width
    • border-radius
    • border-right
    • border-right-color
    • border-right-style
    • border-right-width
    • border-spacing
    • border-style
    • border-top
    • border-top-color
    • border-top-left-radius
    • border-top-right-radius
    • border-top-style
    • border-top-width
    • border-width
    • bottom
    • box-decoration-break
    • box-sizing
    • caption-side
    • clear
    • clip
    • clip-path
    • clip-rule
    • color
    • column-break-after
    • column-break-before
    • column-count
    • column-fill
    • column-gap
    • column-rule
    • column-rule-color
    • column-rule-style
    • column-rule-width
    • column-span
    • column-width
    • columns
    • content
    • counter-increment
    • counter-reset
    • direction
    • display
    • dominant-baseline
    • empty-cells
    • fill
    • fill-opacity
    • fill-rule
    • filter
    • float
    • font
    • font-family
    • font-size
    • font-stretch
    • font-style
    • font-variant
    • font-weight
    • footnote-display
    • footnote-style-position
    • height
    • hyphens
    • left
    • letter-spacing
    • line-height
    • line-stacking-strategy
    • list-style
    • list-style-image
    • list-style-position
    • list-style-type
    • margin
    • margin-bottom
    • margin-inside
    • margin-left
    • margin-outside
    • margin-right
    • margin-top
    • marker-end
    • marker-mid
    • marker-start
    • marks
    • mask
    • max-height
    • max-width
    • min-height
    • min-width
    • opacity
    • orphans
    • overflow
    • overflow-wrap
    • padding
    • padding-bottom
    • padding-left
    • padding-right
    • padding-top
    • page
    • page-break-after
    • page-break-before
    • page-break-inside
    • position
    • prince-background-image-resolution
    • prince-bleed
    • prince-bookmark-label
    • prince-bookmark-level
    • prince-bookmark-state
    • prince-bookmark-target
    • prince-caption-page
    • prince-fallback-cmyk-profile
    • prince-filter-resolution
    • prince-flow
    • prince-footnote-policy
    • prince-forced-breaks
    • prince-hyphenate-after
    • prince-hyphenate-before
    • prince-hyphenate-character
    • prince-hyphenate-lines
    • prince-hyphenate-patterns
    • prince-image-magic
    • prince-image-resolution
    • prince-linebreak-magic
    • prince-link
    • prince-mark-length
    • prince-mark-offset
    • prince-mark-width
    • prince-page-group
    • prince-pdf-color-conversion
    • prince-pdf-color-options
    • prince-pdf-destination
    • prince-pdf-duplex
    • prince-pdf-link-type
    • prince-pdf-open-action
    • prince-pdf-output-intent
    • prince-pdf-page-colorspace
    • prince-pdf-page-label
    • prince-pdf-page-layout
    • prince-pdf-page-mode
    • prince-pdf-paper-tray
    • prince-pdf-print-scaling
    • prince-pdf-profile
    • prince-pdf-script
    • prince-pdf-xmp
    • prince-rotate-body
    • prince-shrink-to-fit
    • prince-text-justify
    • prince-text-replace
    • prince-tooltip
    • prince-trim
    • prince-wrap-inside
    • right
    • size
    • src
    • stop-color
    • stop-opacity
    • string-set
    • stroke
    • stroke-dasharray
    • stroke-dashoffset
    • stroke-linecap
    • stroke-linejoin
    • stroke-miterlimit
    • stroke-opacity
    • stroke-width
    • table-baseline
    • table-column-span
    • table-layout
    • table-row-span
    • text-align
    • text-align-last
    • text-anchor
    • text-decoration
    • text-indent
    • text-line-through
    • text-line-through-color
    • text-line-through-style
    • text-overflow
    • text-overline
    • text-overline-color
    • text-overline-style
    • text-transform
    • text-underline
    • text-underline-color
    • text-underline-style
    • top
    • transform
    • transform-origin
    • unicode-bidi
    • unicode-range
    • vertical-align
    • visibility
    • white-space
    • widows
    • width
    • word-break
    • word-spacing
    • writing-mode
    • z-index
  • A4. CSS Selectors
    • Terminology and Definitions
    • Logical Combinations
    • Elemental Selectors
    • Attribute Selectors
    • Linguistic Pseudo-classes
    • Location Pseudo-classes
    • Tree-Structural pseudo-classes
    • Combinators
    • Tree-Abiding Pseudo-element Selectors
    • Typographic Pseudo-element Selectors
    • Footnote Pseudo-element Selectors
    • Page Selectors
  • A5. CSS Media Queries
    • Media Queries
    • Media Query Modifiers
    • Media Types
    • Media Features
    • Dimension Media Features
    • Display Quality Media Features
    • Color Media Features
    • Interaction Media Features
    • Scripting Media Features
  • A6. CSS Functional Expressions
    • CSS Functions
    • Prince Specific Functions
  • A7. CSS At-rules
    • Initial At-Rules
    • Nested At-Rules
  • A8. Page Size Keywords
  • A9. Character Entities
    • Accented Letters
    • Symbols
    • Quotes
    • Accents
    • Miscellaneous
  • A10. Acknowledgements

Command-line Reference

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 http://example.com -o out.pdf
Convert the 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
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.
prince doc.html --raster-output=doc_%d.png
Process doc.html and rasterize the output to the series of files doc_1.png, doc_2.png, doc_3.png etc.

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.

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.

Options

The command-line may include the options described below:

General Options

-h, --help
Display usage and options.
--version
Display version information.
--credits
Display credits and acknowledgements.

Logging Options

-v, --verbose
Log informative messages.
--debug
Log debug messages.
--log=FILE
Append log messages to a file.
--no-warn-css-unknown
Do not warn about unknown CSS features.
--no-warn-css-unsupported
DO not warn about unsupported CSS features.
--no-warn-css
Do not warn about CSS problems, this option implies the above two options.

Input Options

-i FORMAT, --input=FORMAT
Set input format [auto | xml | html].
-l, --input-list=FILE
Read input file list from specified file.
--baseurl=URL
Specify the base URL of the input document.
--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
Specify the root directory for absolute filenames (deprecated).
--xinclude
Enable XInclude and XML external entities (XXE). Note that XInclude only applies to XML files. To apply it to HTML files, the input format needs to be specified with the --input command-line option.
--xxe, --xml-external-entities
Enable XML external entities (XXE).
--no-local-files
Disable access to local files.

Network Options

--no-network
Disable network access (prevents HTTP downloads).
--auth-user=USER
Specify the username for HTTP authentication.
--auth-password=PASS
Specify the password for HTTP authentication.
--auth-server=HOST[:PORT]
Send username and password credential to the specified server only. (The default is to send them to any server which challenges for authentication).
--auth-scheme=SCHEME
Send username and password credentials only for requests with the given scheme, either http or https
--auth-method=METHOD
Specify a comma separated list of HTTP authentication methods to enable. Valid entries are: basic, digest, ntlm and negotiate. The default is basic.
--auth=URL
Specify a URL with credentials for HTTP authentication: [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
Do not send credentials to named servers until an authentication challenge is received. When multiple authentication methods are enabled, an initial request may be required to discover the methods supported by the remote site.
--http-proxy=PROXY
Specify the HTTP proxy server.
--http-timeout=SEC
Specify the HTTP timeout in seconds.
--cookie=COOKIE
Set a value for the Set-Cookie HTTP header value. --cookie may be used multiple times.
--cookiejar=FILE
Specify a file containing HTTP cookies.
--ssl-cacert=FILE
Specify an SSL certificate file.
--ssl-capath=PATH
Specify an SSL certificate directory.
--ssl-version=VERSION
Set the minimum version of SSL to allow. May be one of: default (let libcurl choose), tlsv1, tlsv1.0, tlsv1.1 or tlsv1.2.
--insecure
Disable SSL verification (not recommended).
--no-parallel-downloads
Disable downloading multiple HTTP resources at once.

JavaScript Options

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

CSS Options

-s FILE, --style=FILE
Apply an external style sheet.
--media=MEDIA
Specify the media type (eg. print, screen).
--page-size=SIZE
Specify the page size (eg. A4, "155mm 190mm", etc). The syntax is the same as the 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
Specify the page margin (eg. 20mm).
--no-author-style
Ignore author style sheets.
--no-default-style
Ignore default style sheets.

PDF Output Options

-o FILE.PDF, --output=FILE.PDF
Specify the output PDF file.
--pdf-profile=PROFILE
Specify the PDF profile (see PDF Profiles) to use.
--pdf-output-intent=ICC
Specify the ICC 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.
--force-identity-encoding
Ensure that all fonts are encoded in the PDF using their identity encoding (directly mapping to glyph indices), even if they could have used MacRoman or some other encoding.
--no-compress
Disable compression of PDF output.
--convert-colors
Convert colors to output intent color space.
--fallback-cmyk-profile=ICC
Set fallback ICC profile for uncalibrated CMYK.

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-xmp=XMP
Include additional XMP metadata in the PDF. The argument is an XMP file, from which the data is taken.

PDF Encryption Options

--encrypt
Encrypt PDF output.
--key-bits=NUM
Set encryption key size either 40 or 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.

Raster Output Options

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
Set the format for the raster output. Valid formats are: 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
Set the range of pages to be rasterize. Valid ranges are all (the default), first and NUM (a single page).
--raster-dpi=DPI
Set the resolution of raster output (The default is 96 dots per inch).
--raster-threads=NUM
Set the number of threads to use for multi-threaded rasterization. By default Prince chooses the number of threads based on the number of cores and hyperthreads your system provides.
--raster-background=BACKGROUND
Set the background - allowed values are [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.

Utility Options

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

Advanced Control and Log Options

--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.

Copyright © 2002 – 2019 YesLogic Pty. Ltd.
  • About Us
  • Privacy Policy
  • Contact Us