XPages – Print RichText to PDF

With iText it is fairly easy to create PDF documents from Notes Documents in the browser. I have already written an article on how to do this.

Today I would like to share a small piece of code that lets you convert NotesRichText into PDF.

The download contains all the neccessary elements.

If you want to use the code in your own application, make sure that the “Store content as HTML and Mime” is checked for your RTItem.

“Create PDF” – Button code:

de.eknori.HTML code:

The result:

It’s not perfect. Embedded images do not work and aslo some styles do not convert well. This does not mean that it is impossible, but you have to write a few extra lines of code to make it work.