iText HTMLWorker Style guide

iText provides a way to convert HTML snippets to PDF using the HTMLWorker class. Unfortunately there isn’t much documentation on what you can do for styles. In order to figure this out I went through the source code. I’m putting it here so that I won’t have to do that again, and so that others will be able to gain something from my pain.

This is from iText 2.0.8

HTMLWorker supported tags

“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”










TagAttribute [iText methods]Values
palign [setAlignment()]center, right, justify
pleading [setLeading()]float or float, float
pbefore [setSpacingBefore()]float
pafter [setSpacingAfter()]float
pextraparaspace [setExtraParagraphSpace()]float


If you find any more let me know and I’ll add them to the list.

Ken

Share