Hi there,
I have upgraded from iText version 2.7 and using iText 5.3.3 and
xmlworker-1.2.0. I have XML snippets with <sup>/<sub> tags and the html
converts to PDF nicely but fails to accept styling that I apply via
CssResolver. Thanks for your help.
StringReader reader = new StringReader(htmlString);
XMLWorkerFontProvider fontProvider = new
XMLWorkerFontProvider();fontProvider.register(fontPath + "/arial.ttf");
CssAppliers cssAppliers = new CssAppliersImpl(fontProvider);
HtmlPipelineContext htmlContext = new HtmlPipelineContext(cssAppliers);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
//Applying style
CSSResolver cssResolver =
XMLWorkerHelper.getInstance().getDefaultCssResolver(true);
cssResolver.addCss("sub,sup{font-size:20px;}", true);
Pipeline<?> pipeline = new CssResolverPipeline(cssResolver,new
HtmlPipeline(htmlContext,new PdfWriterPipeline(pdfDoc, pw)));
ElementList list2 = new ElementList();
XMLWorkerHelper.getInstance().parseXHtml(list2,reader);
Paragraph para = new Paragraph("", ft);
para.setLeading(15);
para.setAlignment(Element.ALIGN_JUSTIFIED);
para.setAlignment(Element.ALIGN_LEFT);
for(int k=0; k<list2.size();++k)
para.add((Element)list2.get(k));
ct.addElement(para);
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php