// and positive is down and to the right. (0,0) is where the
// viewBox puts it.
generator.add(sx + " 0 0 " + sy + " " + fx + " " + fy + " cm\n");
final boolean textAsShapes = false;
PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes,
pdfContext.getFontInfo(), generator.getDocument(),
generator.getResourceContext(), pdfContext.getPage().referencePDF(),
"", 0.0f);
graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
AffineTransform transform = new AffineTransform();
transform.translate(fx, fy);
generator.getState().concatenate(transform);
graphics.setPaintingState(generator.getState());
graphics.setOutputStream(generator.getOutputStream());
Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
imageG2D.getGraphics2DImagePainter().paint(graphics, area);
generator.add(graphics.getString());
if (accessibilityEnabled) {
generator.restoreGraphicsStateAccess();
} else {
generator.restoreGraphicsState();
}