Heya!
Since iText's HTMLWorker doesn't add any margin after p elements while
web browsers by default do, I tried adding some using StyleSheet object:
HTMLWorker hWorker = new HTMLWorker(doc);
StyleSheet styles = new StyleSheet();
styles.loadTagStyle("p", "after", "10");
hWorker.setStyleSheet(styles);
...
However, the style did not make any difference. I poked around the
latest SVN code and found out that HTMLWorker.startElement(String,
HashMap) has the following processing for p elements:
if (tag.equals("p")) {
cprops.addToChain(tag, h);
currentParagraph = FactoryProperties.createParagraph(h);
return;
}
Unfortunately, FactoryProperties.createParagraph(HashMap) only supports
align and leading. On the otherhand,
FactoryProperties.createParagraph(ChainedProperties) supports align,
leading, before, after, and extraparaspace.
Is there any reason why not replace the call
currentParagraph = FactoryProperties.createParagraph(h);
in the above p tag processing with
currentParagraph = FactoryProperties.createParagraph(cprops);
After the change, FactoryProperties.createParagraph(HashMap) could be
removed, since p processing is the only user of it (afaik).
--
Regards,
Pauli Borodulin <[email protected]>
Systems Specialist, tel. +358 3 3551 7892
Computer Centre / Room B4179A
University of Tampere, Finland
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php