Feed on
 Posts
 Comments
Java Beans dot Asia

Just a few simple tutorials …

I had some time during this weekend, so I used iText, free Java-PDF library to make a plug in for Pebble blogging software. This plug in now allows to export blog entries to PDF document.

I liked this library, except one thing – converting HTML snippets to PDF. The library allows you to set styles to HTML tags during export.

The conversion is done with the help of HTMLWorker class. It is also possible to assign different styles to tags supported by HTMLWorker:

ol ul li a pre font span br p div body table td th tr i b u sub sup em
strong s strike h1 h2 h3 h4 h5 h6 img

Unfortunately there isn’t much documentation on what you can do for styles. So after poking through the source code, and going through iText mailing lists for examples, my results were a bit disappointing.

The PDF export works fine, except the case when blog entry has images. In that case, images exported to PDF having text overlaying on top of them.

I am hoping, that some of the people who had done a lot of work in the past using iText, will be able to share their experience.

Recent update:
In my later post, I talk about Flying Saucer Java library, which is XML/XHTML/CSS 2.1 renderer, that uses iText and allows to render CSS stylesheets and XHTML, either static or generated, directly to PDFs.

GD Star Rating
loading...

Related posts:

  1. Export to PDF using iText and Flying Saucer
    In my previous post I attempted to generate PDF on the fly using iText library. My goal was to parse HTML snippet into...
  2. Export Pebble Blog Entry to PDF Plugin
    In one of my previous posts, I described how I implemented a plug in for Pebble blogging software that allows export of blog...
  3. Online PDF Generator
    Online PDF generator now available. This simple but useful online PDF generator tool allows you to generate PDF document online from HTML snippets....
  4. Blogging Software Pebble is Almost Six Years Old!
    Simon Brown, the creator of Pebble blogging tool has retired. He stepped back due to personal reasons after 5 years of leading the...
  5. Generate PDF with Flying Saucer and iText by Adding Font Files
    In this post, I would like to show how to load font files and format specific sections of the document at run time,...