diff options
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/svg/PDFGraphics2D.java | 16 | ||||
-rw-r--r-- | src/java/org/apache/fop/svg/PDFImageElementBridge.java | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 90e7f91a0..ddf9d34e1 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -152,6 +152,12 @@ public class PDFGraphics2D extends AbstractGraphics2D { protected int baseLevel = 0; /** + * The count of JPEG images added to document so they recieve + * unique keys. + */ + protected int jpegCount = 0; + + /** * The current font information. */ protected Document fontInfo; @@ -340,9 +346,13 @@ public class PDFGraphics2D extends AbstractGraphics2D { * @param width the width to draw the image * @param height the height to draw the image */ - public void addJpegImage(JpegImage jpeg, float x, float y, float width, float height) { - FopPDFImage fopimage = new FopPDFImage(jpeg, ""); - int xObjectNum = this.pdfDoc.addImage(resourceContext, fopimage).getXNumber(); + public void addJpegImage(JpegImage jpeg, float x, float y, + float width, float height) { + String key = "__AddJPEG_"+jpegCount; + jpegCount++; + FopPDFImage fopimage = new FopPDFImage(jpeg, key); + int xObjectNum = this.pdfDoc.addImage(resourceContext, + fopimage).getXNumber(); AffineTransform at = getTransform(); double[] matrix = new double[6]; diff --git a/src/java/org/apache/fop/svg/PDFImageElementBridge.java b/src/java/org/apache/fop/svg/PDFImageElementBridge.java index 2d58a6a86..aab0d089d 100644 --- a/src/java/org/apache/fop/svg/PDFImageElementBridge.java +++ b/src/java/org/apache/fop/svg/PDFImageElementBridge.java @@ -97,6 +97,7 @@ public class PDFImageElementBridge extends SVGImageElementBridge { (purl.toString(), purl.openStream(), null); if (ii.mimeType.toLowerCase() == "image/jpeg") { JpegImage jpeg = new JpegImage(ii); + jpeg.load(FopImage.ORIGINAL_DATA, null); PDFJpegNode node = new PDFJpegNode(jpeg, origGN); Rectangle2D imgBounds = getImageBounds(ctx, e); @@ -154,7 +155,6 @@ public class PDFImageElementBridge extends SVGImageElementBridge { public void primitivePaint(Graphics2D g2d) { if (g2d instanceof PDFGraphics2D) { PDFGraphics2D pdfg = (PDFGraphics2D) g2d; - pdfg.setTransform(getTransform()); float x = 0; float y = 0; try { |