Prince produces PDF 1.4 files that are compatible with Adobe Acrobat and other PDF viewers such as Ghostview and Xpdf.
Prince supports a wide range of PDF features, including:
Prince supports PDF-internal and -external links. HTML hyperlinks are
automatically converted. To make an element in XML, or any arbitrary
element, a clickable link, the prince-link
CSS property
is required.
xref[ref-type="bibr"] {
prince-link: attr(rid, idref)
}
The property prince-pdf-link-type
may be used
to control whether relative links should be embedded in the PDF as web (URL)
links or file links. By default they will be resolved against the base URL of
the input document.
Prince also allows to create named destinations in PDF files that have a similar
function to HTML IDs: they can be the target anchors for links from other documents.
The property prince-pdf-destination
is used for
this purpose.
<div class="section" data-sectionid="section1">
…
div.section {
prince-pdf-destination: attr(data-sectionid, string)
}
Prince supports the URL scheme for PDF actions, pdf-action:
.
Possible values are GoBack
, GoForward
,
NextPage
, PrevPage
, FirstPage
,
LastPage
.
However, Prince passes the provided values verbatim to the PDF viewer, so the user can supply values that Prince doesn't know about, but the viewer does.
The property prince-pdf-open-action
maybe used
to specify an action to perform when the PDF file is opened, like eg. popping
up the print dialog box automatically. Any arbitrary identifier can be specified,
although these may be PDF viewer specific; Acrobat can take just about any menu
item.
In a similar fashion, JavaScript code that will be executed when the PDF file
is opened may be included with the prince-pdf-script
property. A common use case is to activate the "Print" dialog automatically.
@prince-pdf {
prince-pdf-script: "this.print();"
}
Prince allows for some degree of control on the pages and the page layout in a PDF
file. The CSS property prince-pdf-page-label
can
be used to set the page label that will be displayed in the PDF viewer. It can be
used to instruct the PDF viewer to display the page label in the ToC in a particular
way.
The property prince-pdf-page-mode
can be used to
set the default page mode for the PDF file when it is opened. For example, whether
the bookmarks panel should be displayed, and whether the viewer should be fullscreen.
Also the default page layout for the PDF file when it is opened can be determined
with the prince-pdf-page-layout
property - for
example, whether the PDF pages should be displayed in one or two columns. The
values two-column-left
and two-column-right
tell
whether the first page is respectively a left page, or a right page.
Prince also provides two properties to fine-tune the printing of the PDF. The
property prince-pdf-print-scaling
can be used
to disable print scaling for the PDF file when it is printed and the property
prince-pdf-paper-tray
controls the
PickTrayByPDFSize flag in generated PDF files, which specifies whether the PDF
page size is used to select the input paper tray.
Prince compresses its PDF output to reduce the size of the documents that it produces. Prince does not create linearized PDF files, as this would increase formatting time and memory requirements. An external program such as Adobe Acrobat or Ghostscript may be used for this purpose if necessary.
Compression may be disabled with the command-line option
--no-compress
.
Prince embeds fonts in its PDF output to ensure accurate
viewing and printing on any system. Font embedding can be disabled if
necessary, for example if Prince is being used to create PDF files in
a controlled environment with known fonts where space is at a premium.
The command-line option
--no-embed-fonts
is used for this purpose.
Support for PostScript output has been removed from Prince and we recommend the use of PDF instead. If necessary, an external converter program such as Adobe Acrobat or Ghostscript may be used in conjunction with Prince, to convert its PDF output into PostScript.