Hi there,
I am trying to add a chunk of html to my pdf document, which it is doing
nicely, but I am unable to apply style tags via CSSResolver, can someone
have a look at the code below and advise, thanks.
XMLWorkerFontProvider fontProvider = new
XMLWorkerFontProvider();
fontProvider.register(fontPath + "/arial.ttf");
CssAppliers cssAppliers = new
CssAppliersImpl(fontProvider);
HtmlPipelineContext htmlContext = new
HtmlPipelineContext(cssAppliers);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
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));
//ColumnText
ct.addElement(para);
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Trouble-applying-style-to-html-snippet-via-CSSResolver-tp4656661.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
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