All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.openhtmltopdf.svgsupport.BatikSVGDrawer Maven / Gradle / Ivy

Go to download

Open HTML to PDF is a CSS 2.1 renderer written in Java. This artifact supports drawing SVG graphics on to PDFs using Apache Batik.

There is a newer version: 1.0.10
Show newest version
package com.openhtmltopdf.svgsupport;

import java.util.List;

import org.w3c.dom.Element;

import com.openhtmltopdf.css.sheet.FontFaceRule;
import com.openhtmltopdf.extend.SVGDrawer;
import com.openhtmltopdf.layout.SharedContext;
import com.openhtmltopdf.svgsupport.PDFTranscoder.OpenHtmlFontResolver;

public class BatikSVGDrawer implements SVGDrawer {
    public OpenHtmlFontResolver fontResolver;

    @Override
    public void importFontFaceRules(List fontFaces,
            SharedContext shared) {
        this.fontResolver = new OpenHtmlFontResolver();
        this.fontResolver.importFontFaces(fontFaces, shared);
    }

    @Override
    public SVGImage buildSVGImage(Element svgElement, double cssWidth,
            double cssHeight, double cssMaxWidth, double cssMaxHeight,
            double dotsPerPixel) {
        BatikSVGImage img = new BatikSVGImage(svgElement, cssWidth, cssHeight,
                cssMaxWidth, cssMaxHeight, dotsPerPixel);
        img.setFontResolver(fontResolver);
        return img;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy