Railsmagazine60x60 Interview with Michael Day of Prince XML

Issue: Vol 2, Issue 1 - All Stuff, No Fluff

published in June 2010

Michael day

Michael Day is the CEO and co-founder of YesLogic, the company behind the Prince formatter for printing web content to PDF.


What is Prince XML? What differentiates it in the market?

Prince is a tool for converting web content, specifically HTML and XML, to PDF, by applying CSS style sheets. It can be used as a standalone converter, but usually it is integrated into websites and apps that need to produce PDF output. Prince can publish invoices, letters, manuals, catalogs, documentation, magazines, and even books.

There are many ways of making PDF files, but most people have some level of experience with HTML and CSS, especially if they are working on a web application! Prince allows people to take advantage of their existing skills, and even to reuse their existing templates and style sheets to create printable PDF files.

What is your background? How did you start YesLogic and how large is it today?

YesLogic began as a small company here in Melbourne, Australia, in 2002. Our background is in software development, mainly XML processing, with a strong interest in declarative programming languages. In 2003 we made the first public release of Prince, and it's been our flagship product ever since.

In 2004 we met Håkon Wium Lie, the co-inventor of CSS and the CTO of Opera Software. Håkon used Prince to print his PhD thesis, and also the 3rd edition of his book "Cascading Style Sheets: Designing for the Web". http://www.amazon.com/Cascading-Style-Sheets-Designing-Web/dp/0321193121

Håkon joined the company board in 2005, apparently so that he could make sure we implemented his favourite features! Since then he has continued to work with the W3C on improving CSS for print, along with his many other commitments to developing the web, and has been a great source of guidance for us on business and technical matters.

We are still a small company, with a focus on software development and customer support. But life is much busier now that Prince is being used to publish amazing things all over the world.

How did you get the idea of creating Prince XML?

We like HTML and CSS, and using web technologies for printing seemed so obvious that we couldn't understand why good tools didn't already exist.

Unknown to us, Håkon had already anticipated Prince by several years, when way back in 2000 he posted this on the W3C style mailing list:

   why hasn't anyone produced a decent
      X(HT)ML + CSS -> PDF


Originally our focus was on printing XML, which was a hot topic at the time with the debates over CSS vs. XSL, but later we naturally began to gravitate towards printing HTML and other web content generally.

What is your position on web standards, and your relationship with W3C/CSS standardization body? What are your thoughts on the current state of CSS with regard to the print medium? Are there any particular limitations or things you'd like to change?

Web standards are great! They are freely available for any company or individual to work with, and unencumbered by patents, giving everyone a level playing field to build innovative products and services.

More pragmatically, our whole business is based on the idea of using open standards wherever possible. As a small company, we can't bully customers or competitors into doing things our way, so cooperation and interoperability is our only hope for making a valuable product.

Since web browsers have historically been focused on screen display, there are definitely improvements that could be made to CSS with regards to print, and Håkon is working on these as editor of the CSS3 modules for Paged Media and Generated Content for Paged Media:



These include some features found in traditional print publishing, such as footnotes and page number cross-references, already supported in Prince and some other implementations.

The time seems to have finally come for HTML 5. What are the plans for Prince XML in this area? What are the new capabilities introduced by HTML 5 that will have the most impact on the print medium, if any?

The development of HTML5 has definitely made the web a more interesting place, but it hasn't had a big impact on Prince yet. For Prince 7.1, we made minor updates to our default style sheets to support some of the new elements introduced in HTML5:

figure, figcaption { display: block }

article, aside, section, hgroup { display: block }

header, footer, nav { display: block }

There has been considerable interest in supporting the <canvas> element in Prince in the future. This would require JavaScript, and allow scripts to draw graphs or charts on the canvas that would get included in generated PDF files. Supporting JavaScript in Prince would be a big job, but it would open up some very exciting new possibilities.

What are the main capabilities introduced with Prince 7? What is coming up in Prince 7.1 and beyond?

In Prince 7.0 we did a lot of internationalisation work to support the Indic scripts (Hindi, Bengali, Tamil, etc.) and also right-to-left scripts like Arabic and Hebrew. This required us to support OpenType font layout features, which allow Prince to apply kerning and ligatures, and even use real small-caps instead of fake scaled glyphs. So text in modern well-designed fonts looks a lot better in Prince 7.0.

Another big change was a new hyphenation and justification algorithm, based on Knuth's classic algorithm used in TeX. This can produce more balanced paragraphs that are easier to read, by avoiding large gaps between words where possible. Hyphenation and justification are subtle and complex topics, with a long history in print publishing, that have not received much attention on the web in the past. This may change due to the increased popularity of eBook readers and tablet computers, which have to compete with the readability of traditional books.

Finally, we spent some time on performance tuning, to make Prince 7.0 faster than 6.0 on most of our test cases. Under constant pressure to add features it's easy for inefficiency to creep in, and we've all seen new software that runs slower than the old version. Our goal is to make each major new release of Prince faster than the previous release, and I think we still have some scope for further improvements in the future.

What is the level of support for WOFF in Prince? Do you see this font format becoming the dominant one for web publishing?

Prince 7.1 supports WOFF, the new Web Open Font Format, in addition to regular TrueType and OpenType fonts. I think WOFF is a well-designed format that builds upon existing standards in a sensible way, and hope to see it supported by most browsers in the near future. Ideally it will become the dominant font format for web publishing, because in the past it has been difficult to use new fonts on the web at all.

Your level of support is amazing. It's not often that I see the CEO of a well-know software company being on the forums every day, personally responding to all questions. You are also maintaining a public, cross-referenced product roadmap that seems solely driven by customer inquiries. What are your views on customer support?

We started YesLogic because we were passionate about writing software, and initially did not give much thought to customer support. After all, in the beginning we did not have any customers! However, once people began to use Prince, they were eager for us to add new features, and fix bugs or issues that we had missed. The longer we worked on Prince, the more we realised that software does not exist for its own sake, and that its only purpose is to satisfy its users. This sounds quite obvious, but engineers can sometimes overfocus on technology and forget about people.

For large companies, direct customer support is often minimised by using out-sourced call-centres and "knowledge bases" that discourage customers from contacting the company. These techniques may scale up nicely, but they rarely make people happy.

Small companies have a great opportunity to provide better support to customers, by reducing the distance between the people using the product and the people making it. Bug reports and feature requests can be brought to the attention of developers immediately. We are very happy when we can provide an updated build of Prince on the spot to help a customer solve a problem.

Our customer support is provided primarily through our web forum and over email. These methods are simple but very effective, and avoid any timezone problems that phone support would entail. A big advantage of the forum is that questions are publicly visible and show up in search engines, making it easier for many people to benefit from the answers.

The development roadmap for Prince is public, although we only reveal the URL on the forum in response to questions. (For the curious, it's listed below). Initially we were somewhat wary of opening it up, but it has been well received and I think it is reassuring to see the upcoming work listed there. It's very simple compared to a real bug tracker like Bugzilla, but that's part of its charm, and the basic linear format is easy to navigate. We do cross-reference it with questions on the forum, for convenience.


Although most of what we do is driven by customer demand, we do still have a few ideas of our own! Some of them might even make it into Prince one of these days, so keep an eye on the release notes :)

Prince is implemented in the Mercury programming language. In hind sight, do you feel this gave you a competitive advantage or would you use a different language now, given the choice? What are the key strengths and weaknesses of using Mercury?

Mercury is a logic/functional programming language, developed at the University of Melbourne. You could consider it to have the syntax of Prolog, with the type-system of Haskell. It's available free online and I would encourage you to check it out if you have an interest in programming languages:


We chose the Mercury language to develop Prince because it is powerful and concise, with convenient idioms for manipulating the tree structures found in markup languages and typesetting algorithms. Mercury programs compile down to C code, making Prince efficient and easily portable to different operating systems, without requiring a virtual machine.

Many new languages have been developed on top of the Java and .NET virtual machines, which do provide benefits in terms of portability and integration with other libraries. However, we need Prince to work well with both systems, as we have customers using ASP.NET and Java servlets and many other server frameworks. This is why we have not developed Prince specifically as a Java or .NET component.

With hindsight I think we made the right choice, although Ocaml is another language that would probably have worked just as well. Recently there has been considerable interest in other languages like Erlang and Clojure, but these were not widely used in 2002.

Our first priorities have always been to make Prince work well, and be easy to use. The right choice of language may give a productivity boost, but creating a good product still takes a lot of hard work.

Princely (Michael Bleigh's Rails plugin) is fairly popular, and makes it trivial to build Prince-based Rails applications. In general, how are people using Prince, and did you come across some unexpected usage scenarios?

People are using Prince in all sorts of ways, but it usually involves server code written in PHP, Java, ASP, and of course Ruby on Rails!

The Princely plugin from Michael Bleigh was based on an earlier Ruby binding written by Seth Banks for his Cashboard application in 2007, which brought Ruby on Rails to our attention. But because the plugin "just works" very nicely, there hasn't been much need for further work integrating Prince with Rails, although we are open to suggestions.