Example usage for com.itextpdf.tool.xml XMLWorkerFontProvider DONTLOOKFORFONTS

List of usage examples for com.itextpdf.tool.xml XMLWorkerFontProvider DONTLOOKFORFONTS

Introduction

In this page you can find the example usage for com.itextpdf.tool.xml XMLWorkerFontProvider DONTLOOKFORFONTS.

Prototype

String DONTLOOKFORFONTS

To view the source code for com.itextpdf.tool.xml XMLWorkerFontProvider DONTLOOKFORFONTS.

Click Source Link

Usage

From source file:net.algem.edition.PdfHandler.java

License:Open Source License

public XMLParser createParser(Document document, PdfWriter writer) {
    CSSResolver cssResolver = new StyleAttrCSSResolver();
    XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(XMLWorkerFontProvider.DONTLOOKFORFONTS);
    //    fontProvider.register("resources/fonts/Cardo-Regular.ttf");
    //    fontProvider.register("resources/fonts/Cardo-Bold.ttf");
    //    fontProvider.register("resources/fonts/Cardo-Italic.ttf");
    //    fontProvider.addFontSubstitute("lowagie", "cardo");
    CssAppliers cssAppliers = new CssAppliersImpl(fontProvider);
    HtmlPipelineContext htmlContext = new HtmlPipelineContext(cssAppliers);
    htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
    // Pipelines//  w  w  w .j a v  a  2 s . c  o m
    PdfWriterPipeline pdf = new PdfWriterPipeline(document, writer);
    HtmlPipeline html = new HtmlPipeline(htmlContext, pdf);
    CssResolverPipeline css = new CssResolverPipeline(cssResolver, html);
    // XML Worker
    XMLWorker worker = new XMLWorker(css, true);
    return new XMLParser(worker);
}