com.openhtmltopdf.svgsupport.BatikSVGDrawer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openhtmltopdf-svg-support Show documentation
Show all versions of openhtmltopdf-svg-support Show documentation
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.
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;
}
}