We're currently working on examples.
For instance:
// step 1
Document document = new Document();
// step 2
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(file));
writer.setInitialLeading(12.5f);
// step 3
document.open();
// step 4
XMLWorkerHelper helper = XMLWorkerHelper.getInstance();
// CSS
CSSResolver cssResolver = new StyleAttrCSSResolver();
CssFile cssFile = helper.getCSS(new
FileInputStream("resources/demo2/walden.css"));
cssResolver.addCss(cssFile);
// HTML
XMLWorkerFontProvider fontProvider = new
XMLWorkerFontProvider();
fontProvider.register("C:/windows/fonts/GARA.TTF");
fontProvider.register("C:/windows/fonts/GARAIT.TTF");
fontProvider.register("C:/windows/fonts/GARABD.TTF");
fontProvider.addFontSubstitute("lowagie", "garamond");
CssAppliers cssAppliers = new CssAppliersImpl(fontProvider);
HtmlPipelineContext htmlContext = new
HtmlPipelineContext(cssAppliers);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
// Pipelines
PdfWriterPipeline pdf = new PdfWriterPipeline(document,
writer);
HtmlPipeline html = new HtmlPipeline(htmlContext, pdf);
CssResolverPipeline css = new
CssResolverPipeline(cssResolver, html);
XMLWorker worker = new XMLWorker(css, true);
XMLParser p = new XMLParser(worker);
p.parse(new FileInputStream("results/demo2/walden.html"));
// step 5
document.close();
------------------------------------------------------------------------------
Virtualization
& Cloud Management Using Capacity Planning
Cloud computing makes
use of virtualization - but cloud computing
also focuses on
allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
Hi all,
I'm having trying to use iText (v5.2) & the XMLWorker (v1.1.2) tool
to generate a PDF. Trouble is that the resulting PDF doesn't appear to
be using any of the CSS styles defined on the page. Images are there
but no CSS. I've followed the XMLWorker documentation from
http://demo.itextsupport.com/xmlworker/itextdoc/flatsite.html
but it's
looking out of date with the current version. The main problem at the
moment at the moment is this line in the documentation:
HtmlPipelineContext htmlContext =
new HtmlPipelineContext();
With the versions I am using, the constructor of
HtmlPipelineContext
requires a CssAppliers class. I'm supplying a null object for now as I
have no idea how to get my hands on a CssAppliers
class but could this be what is causing my PDF to come out
with no CSS styles applied? Does anyone have any idea how I get my
hands on a CssAppliers instance? The API docs didn't shed much light on
the situation.
Can anyone help me get past this step? I've attempted to attach my test
class so you can see what I'm trying to do. No idea how attachments
work with this mailing list though...
Regards,
Lee