}*/
if (pdfInfo.pdfContext == null) {
pdfInfo.pdfContext = pdfInfo.pdfPage;
}
PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi,
pdfInfo.pdfDoc,
pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
pdfInfo.currentFontName, pdfInfo.currentFontSize);
graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
pdfInfo.pdfState.push();
AffineTransform transform = new AffineTransform();
// scale to viewbox
transform.translate(xOffset / 1000f, yOffset / 1000f);
if (deviceResolution != uaResolution) {
//Scale for higher resolution on-the-fly images from Batik
double s = uaResolution / deviceResolution;
at.scale(s, s);
pdfInfo.currentStream.add("" + PDFNumber.doubleOut(s) + " 0 0 "
+ PDFNumber.doubleOut(s) + " 0 0 cm\n");
graphics.scale(1 / s, 1 / s);
}
pdfInfo.pdfState.setTransform(transform);
graphics.setPDFState(pdfInfo.pdfState);
graphics.setOutputStream(pdfInfo.outputStream);
try {
root.paint(graphics);
pdfInfo.currentStream.add(graphics.getString());
} catch (Exception e) {
log.error("svg graphic could not be rendered: "
+ e.getMessage(), e);
}