Blue-sky printing with Prince 8
Prince, the 7th
To showcase the formatting magic that Prince can do, we have created one document packed with effects. The HTML document, which is contained in a tiny 13k file, demonstrates these features: bi-directional text, OpenType features, CSS3 footnotes, web fonts (including WOFF), and CSS3 page floats. You can download the PDF document or the HTML source. To produce the same PDF document from on your own computer, you should have the Arno Pro font installed.
Henrik Ibsen’s collected poems were first printed in 1871. The first edition was, as were most books at the time, set in lead by skilled printers. In 2010, the first edition was recreated in HTML and CSS. The «Steinschrift» and «Elzevir» fonts that were used by the printers in 1871 are not available as digital fonts, but lookalikes were found. The resulting PDF file was printed in 100 copies and bound the old-fashioned way.
Advanced Aquarist is a monthly online magazine for the marine aquarist. The publication is not only advanced about marine matters – its electronic publishing pipeline is also impressive. Advanced Aquarist uses Prince to produce PDF files from the HTML files that are published online. Further, the PDF files are printed and is available for purchase (2007 edition, 2008-1)
Gentium is a beautiful font with an unusually wide range of characters. It has been developed by SIL and released under a liberal license. Therefore, it's an ideal webfont which Prince can put to good use. In this sample document (HTML, CSS, PDF), we replace the main heading with another string by way of the 'content' property in CSS. The replacement is nonsensical in the sense that the glyphs have been borrowed from different scripts. But it looks neat!
Wikipedia's fine collection of articles invites content reuse. By stripping the screen-oriented styling and applying a purpose-built style sheet with Prince, Wikipedia articles can be frozen into PDF files for print or archive. We don't have enough disk space for all Wikipedia articles, but we offer some samples (United States, Norway and Soviet Union) that have been created with the same style sheet (CSS). Notice the two-column layout, the embedded Gentium fonts and the top-floating tables. To create PDF files for your favorite topic, try a command similar to this:
prince --no-author-style \ -s http://www.princexml.com/howcome/2008/wikipedia/wiki2.css \ http://en.wikipedia.org/wiki/Finland -o finland.pdf
Product catalogs are complex publications where errors can be fatal. Increasingly, they are offered both on the web and in print. By producing both versions from the same set of files, errors can be minimized. We have created a ficticious product catalog for fine flags that show how a PDF product catalog can be produced from a simple HTML file (PDF, HTML with CSS). The flags themselves are SVG files fetched from Wikipedia. Notice how the table is run into two columns. The table header and footer is repeated in both columns. The headers and footers reflect information (product codes and country names) from the pages. The background of the front page is one SVG image that is automatically repeated.
XTech Conference Papers
The XTech Conference in 2007 was held in Paris. Like the years before, it was a successful event with interesting presentations and hallway conversations. Presenters submitted their papers using an OpenOffice or Word template. Subsequently, the papers were converted to HTML and published on the web. Prince was used to convert the HTML versions to PDF. In the PDF files, notice how SVG is used to generate the XTech logo. Also, being able to set the resolution of the figures is important when paginating the files. (CSS, sample paper in PDF, sample paper in XHTML)
The magic of Prince
The purpose of this document is to showcase the formatting magic Prince can do. Some of our favorite features are high-lighted and the entire document is contained in one single 13k XHTML file with CSS and SVG embedded. If you have Prince installed on your system, you can easily convert the XHTML source into PDF by pasting the URL into the GUI or running this command:
prince -o magic.pdf http://www.princexml.com/samples/magic.xhtml
You can also download the converted PDF file.
The Journal Publishing DTD
The Journal Publishing DTD, also known as the NLM DTD, is an XML vocabulary developed for Journal submissions in the medical field. It's an ambitious specification which the creators hope will be used for other kinds of journals as well. Some sample documents have been made available and we have formatted one of them with Prince (XML, CSS, PDF).
Prince on the green machine
The $100 laptop is an ambitious project to build a minimalist machine for children in poor countries. It has a 366 Mhz processor and 128 MB RAM. Surely, not enough to run a sophisticated program like Prince? We got our hands on a unit and Prince installed flawlessly. We started it with "prince -s wiki.css http://wiki.laptop.org/go/Home", thus fetching a web page and combining it with a local style sheet. The resulting PDF file has footnotes and all. Nice achievement for a small machine!
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. They later described their approach in an article on A list apart: Printing a Book with CSS: Boom!. Prince is currently the only product which is able to produce print-quality PDF files from HTML and CSS files. (HTML, CSS, PDF)
Using the boom! microformat, it's easy to create books from HTML. Mark Burgess wrote his novel, called Slogans, in LaTeX. We converted it to HTML and added a few class names from the boom! vocabulary. Also, the boom! style sheet was modified in a few places to create the kind of presentation the author wanted. Notice how the content of the back cover is shown first in the HTML version. We encourage you to read the novel and let the author know if you like it. (HTML, boom! style sheet, Prince-generated PDF)
Using Prince, web content can easily be recast into PDF. To show how this can be done, we have recreated a PDF newspaper from The Guardian. The text and images were extracted from the original PDF file and the content was encoded in HTML. Using Prince, a new PDF file was created. (Original PDF, HTML, Prince-generated PDF)
Project Gutenberg has extracted a wide range of literary works from paper into electronic files. Is it possible to reverse the process and 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 that has been published in XML by the HTML Writer's Guild (XML). The HWG has also written a style sheet to go 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. However, it is easy to fix these problems by writing 100 lines or so of CSS code and reformatting 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)
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)
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 on XML.com. (HTML, CSS, PDF)
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 the basic structure of math expressions while rendering is specified with CSS. His paper discusses the abilities and limitations of his present approach, and his site has more examples. (XML, CSS, PDF)
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. (PDF)