Samples
Prince has been used to create a wide range of applications and documents and we will show you some samples on this page.
Fruitfinder
Fruitfinder is a sample form-based web application. You can order imaginary apples, pears and oranges from our electronic fruit stand by interacting with the order form. The page is written in HTML and uses DOM and Javascript to calculate costs as you choose your favorite produce. You can also edit the name and shipping adress. When you are done ordering, press "Generate invoice". The fields in the form are then submitted to a server where Prince is running. Prince generates a PDF invoice which is returned to your browser.
Menu Generator
The menu generator lets you create delicious restaurant menus through a simple web interface. Edit the HTML form to descibe and price the food on offer, then submit the form. On the server side, heading fonts are selected based on the atmosphere of your restaurant and the menu is turned into a PDF document which is returned to your browser. Needless to say, the PDF document is generated by Prince running in the server.
The magic of Prince
The purpose of this document is to showcase the formatting magic Prince can do. The page describes ten of our favorite features. The entire document is contained in one single 13k XHTML file. Embedded in the XHTML are CSS and SVG code and you are invited to read the source code as well as the formatted document. This document is included as a sample document in the demonstration version of Prince. (HTML, PDF)
Fiction
Project Gutenberg has extracted a wide range of literary works from
paper into electronic files. Is it possible to reverse the process, to
create printable PDF files from the electronic texts? Using Prince,
the answer is yes. As a sample document, we will use Twelve Stories
and a Dream
by H G Wells and published in XML by
the HTML Writer's Guild (XML). HWG has
also written a style sheet to go along with Gutenberg texts (CSS).
Combining the two in Prince results in a PDF file (PDF) which is suitable for personal
printouts, but not for printing a book. For example, the pages are too
big, there are no page numbers, and each short story does not start on
its own page. It is easy to fix these problems by writing 100 lines or
so of CSS code and reformat the document in Prince. (Also, the XML
document has been amended slightly, e.g., with links to support page numbers
in the table of contents, and curly quote characters.) (XML/CSS/PDF)
OSIS
The OSIS format is used to encode Bible texts. This sample formats one of the letters in the New Testament. Notice how the header on the second page of the PDF document is generated based on the content on the page. Also, the chapter counters are moved into position through counters and generated content. (XML/CSS/PDF)
Cascading Style Sheets – Designing for the Web
In 2005, Addison-Wesley published a book that was formatted by
Prince. Cascading Style Sheets – Designing for the Web
by
Håkon Wium Lie and Bert Bos describes the power of CSS. To prove how
powerful it can be, the authors decided to use CSS in the production
process. Prince is currently the only product which is able to produce
print-quality PDF files from HTML and CSS files. The sample page on the right can be
reproduced by processing this source code into PDF with Prince. (HTML, PDF)
WebArch
W3C Recommendations describe the beloved languages which Prince reads, and being able to format these specifications is therefore like coming home. The CSS style sheets that are used to present these document on the screen can be reused for printing. In addition, a simple style sheet to describe print-specific features have been added. The original HTML document contains a table of contents with hyperlinks from the entries, and this index can be reused to create a table of contents with page numbers in the PDF version. The formatting of the WebArch document was the topic of discussion in an article in XML.com.(HTML/CSS/PDF)
Mathematical Articles
George Chavchanidze has developed a style sheet for formatting mathematical articles with Cascading Style Sheets (CSS). Simple XML 1.0 markup is used to capture basic structure of math expressions while rendering is specified via CSS 2.0/2.1. His paper discusses abilities and limitations of his present approach, and his site has more examples. (XML/CSS/PDF)
English-Catalan dictionary
The English-Catalan dictionary is an open source collaborative project which seeks to provide an up-to-date, comprehensive, English-Catalan dictionary. The PDF file was formatted by Prince 4. Notice how the header in the upper right corner is generated based on the first and last word entry on the page.








