# The magic of Prince

Prince is a computer program that converts XML and HTML into PDF. It is simple, yet very powerful, and it creates beautiful documents. The purpose of this small document is to showcase the formatting magic Prince can do. We have chosen to highlight eighteen of our favorite features. This document is written in HTML and converted to PDF by Prince. The source file is a compact 13k document, including the embedded CSS, SVG and MathML.

## Hyphenation

Prince 6 supports automatic hyphenation which can break words across several lines, adding a hyphen at the word break. Hyphenation is controlled with a set of experimental CSS properties, and hyphenation patterns for different languages can be supplied. Notice how the text in this document is hyphenated.

## Rounded borders

CSS3 introduces support for rounded borders. In the table below, some of the corners have been rounded. On purpose, the bottom right corner has an asymmetrical shape.

fruit computer yes yes yes no

## Character substitution

It's sometimes convenient to replace one character with another without changing the source document. For example, the apostrophe character is easily found on keyboards, but in print it's common to replace it with a quotation character. Notice how Prince 6 has replaced the apostrophes in this paragraph.

## HTTP support

Prince 6 has built-in HTTP support and can fetch pages, images, DTDs and style sheets from the web. The image to the left was automatically fetched when the PDF version was generated.

## Web fonts

Prince 6 can fetch fonts from the web and use them without installing them on your system. The fonts used in the PDF version of this document are web fonts. We are grateful to Ray Larabie, Dieter Steffmann, and Red Hat for making hi-quality fonts freely available.

## Image resolution

Sometimes images should be scaled to a certain resolution, rather than to an absolute size. In Prince, you can set the resolution of an image as a property in the style sheet. The smiley face in the previous section was scaled this way. The smiley also represents the challenging Acid2 test, which Prince 6 passes.

## Columns

Columns are commonly used on paper and Prince supports multi-column layouts described in CSS. This document is laid out in two columns. Also, this section uses a two-column layout with gap and a rule between. The width of the gap and the style of the rule is set in the style sheet.

## CMYK colors

Printers don't use RGB colors, they mostly use CMYK: cyan, magenta, yellow and black. Prince 6 can read CMYK colors and will use them, if present. The heading above this paragraph has both an RGB color (red) and a CMYK color (bluish). Therefore, the text is red in browsers, but blue in the PDF version. This is for demonstration purposes; normally the colors would be close to each other.

## Counters

If you are reading the XHTML source code of this document, look for the `h2` elements. You will notice that they contain the text of the headings, but not their number. The list item number, including the # and : are automatically generated by the style sheet. Generated content and counters are especially useful for complex documents. They are described in CSS level 2.1.

## Crop and cross marks

In printing, crop marks are used to indicate where the printed paper should be cut. Cross marks are used to align prints of different colors to improve color reproduction. Prince 6 adds support for crop and cross marks, and the PDF version of this document includes both.

## Cross-references

Prince can read hyperlinks inside a document and generate page numbers accordingly. For example, it will automatically find out which page Headers and Footers are discussed on (page). Cross-references are used to generate the Table of contents (page).

## Math

Prince 6 add experimental support for MathML. Here is an example:

$x\stackrel{\text{maps to}}{\to }y={f}_{n}\left(x\right)={\left(1+\frac{1}{{x}^{n}}\right)}^{n}$

## Footnotes

FootnotesA footnote is a note placed at the bottom of a page of a book or manuscript that comments on or cites a reference for a designated part of the text. are essential in printed documents and Prince knows how to generate them. Unlike what some people think, footnotes are not the place to put information you don't want to see. More often, footnotes will actually attract attention. 9 of 10 of readers will read the footnotes before they read the text from where the footnotes are anchored.Often, the most interesting information is found in the footnotes.

## SVG

Scalable Vector Graphics (SVG) is a language for describing two-dimensional graphics for the web. SVG images scale better than traditional bitmapped images and are suitable for printing. The crown is generated by two SVG elements.

## Page floats

On paged media, elements can be set float to the top or bottom of pages. The big URL at the top of this page comes after this paragraph in the source code, but is floated to the top by the style sheet.