import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
import org.apache.fop.render.AbstractImageHandlerGraphics2D;
+import org.apache.fop.render.ImageHandlerUtil;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
import org.apache.fop.svg.PDFGraphics2D;
float imw = (float)dim.getWidth() / 1000f;
float imh = (float)dim.getHeight() / 1000f;
- float sx = fwidth / (float)imw;
- float sy = fheight / (float)imh;
+ float sx = fwidth / imw;
+ float sy = fheight / imh;
generator.comment("G2D start");
boolean accessibilityEnabled = context.getUserAgent().isAccessibilityEnabled();
/** {@inheritDoc} */
public boolean isCompatible(RenderingContext targetContext, Image image) {
- return (image == null || image instanceof ImageGraphics2D)
+ boolean supported = (image == null || image instanceof ImageGraphics2D)
&& targetContext instanceof PDFRenderingContext;
+ if (supported) {
+ String mode = (String)targetContext.getHint(ImageHandlerUtil.CONVERSION_MODE);
+ if (ImageHandlerUtil.isConversionModeBitmap(mode)) {
+ //Disabling this image handler automatically causes a bitmap to be generated
+ return false;
+ }
+ }
+ return supported;
}
}
import org.apache.fop.image.loader.batik.BatikImageFlavors;
import org.apache.fop.image.loader.batik.BatikUtil;
import org.apache.fop.render.ImageHandler;
+import org.apache.fop.render.ImageHandlerUtil;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
import org.apache.fop.svg.PDFAElementBridge;
graphics.setOutputStream(generator.getOutputStream());
try {
root.paint(graphics);
+ ctx.dispose();
generator.add(graphics.getString());
} catch (Exception e) {
SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
/** {@inheritDoc} */
public boolean isCompatible(RenderingContext targetContext, Image image) {
- return (image == null
+ boolean supported = (image == null
|| (image instanceof ImageXMLDOM
&& image.getFlavor().isCompatible(BatikImageFlavors.SVG_DOM)))
&& targetContext instanceof PDFRenderingContext;
+ if (supported) {
+ String mode = (String)targetContext.getHint(ImageHandlerUtil.CONVERSION_MODE);
+ if (ImageHandlerUtil.isConversionModeBitmap(mode)) {
+ //Disabling this image handler automatically causes a bitmap to be generated
+ return false;
+ }
+ }
+ return supported;
}
}