diff options
author | Keiron Liddle <keiron@apache.org> | 2002-06-28 10:09:07 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-06-28 10:09:07 +0000 |
commit | 73d16e990b458dfbd9db7d68085da601c49d9c42 (patch) | |
tree | 776879d5a2a26abec2228cacf6ff0781db239256 /src/org/apache/fop/render/pdf | |
parent | 00dd98af348dcae07fa4f0ea8838ccb2603e7d94 (diff) | |
download | xmlgraphics-fop-73d16e990b458dfbd9db7d68085da601c49d9c42.tar.gz xmlgraphics-fop-73d16e990b458dfbd9db7d68085da601c49d9c42.zip |
handles pattern resources better
made stream filters externally configured
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render/pdf')
-rw-r--r-- | src/org/apache/fop/render/pdf/FontSetup.java | 3 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/FopPDFImage.java | 10 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/PDFRenderer.java | 10 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/org/apache/fop/render/pdf/FontSetup.java b/src/org/apache/fop/render/pdf/FontSetup.java index f450a5b76..234c48219 100644 --- a/src/org/apache/fop/render/pdf/FontSetup.java +++ b/src/org/apache/fop/render/pdf/FontSetup.java @@ -189,10 +189,9 @@ public class FontSetup { * @param doc PDF document to add fonts to * @param fontInfo font info object to get font information from */ - public static void addToResources(PDFDocument doc, FontInfo fontInfo) { + public static void addToResources(PDFDocument doc, PDFResources resources, FontInfo fontInfo) { HashMap fonts = fontInfo.getUsedFonts(); Iterator e = fonts.keySet().iterator(); - PDFResources resources = doc.getResources(); while (e.hasNext()) { String f = (String)e.next(); Font font = (Font)fonts.get(f); diff --git a/src/org/apache/fop/render/pdf/FopPDFImage.java b/src/org/apache/fop/render/pdf/FopPDFImage.java index ca248b010..fac035be0 100644 --- a/src/org/apache/fop/render/pdf/FopPDFImage.java +++ b/src/org/apache/fop/render/pdf/FopPDFImage.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.awt.color.ColorSpace; import java.awt.color.ICC_ColorSpace; import java.awt.color.ICC_Profile; +import java.util.HashMap; public class FopPDFImage implements PDFImage { FopImage fopImage; @@ -32,6 +33,7 @@ public class FopPDFImage implements PDFImage { String maskRef; String softMaskRef; boolean isPS = false; + HashMap filters; public FopPDFImage(FopImage im) { fopImage = im; @@ -44,7 +46,7 @@ public class FopPDFImage implements PDFImage { } public void setup(PDFDocument doc) { - + filters = doc.getFilterMap(); if ("image/jpeg".equals(fopImage.getMimeType())) { pdfFilter = new DCTFilter(); pdfFilter.setApplied(true); @@ -55,7 +57,7 @@ public class FopPDFImage implements PDFImage { if (prof != null) { pdfICCStream = doc.makePDFICCStream(); pdfICCStream.setColorSpace(prof, pdfCS); - pdfICCStream.addDefaultFilters(); + pdfICCStream.addDefaultFilters(filters, PDFStream.CONTENT_FILTER); } } } @@ -116,7 +118,7 @@ public class FopPDFImage implements PDFImage { imgStream.addFilter(pdfFilter); } - imgStream.addDefaultFilters(); + imgStream.addDefaultFilters(filters, PDFStream.IMAGE_FILTER); return imgStream; } } @@ -170,7 +172,7 @@ public class FopPDFImage implements PDFImage { imgStream.setData(imgData); - imgStream.addDefaultFilters(); + imgStream.addDefaultFilters(filters, PDFStream.CONTENT_FILTER); return imgStream; } diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 69ed8770d..5fb059a83 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -165,7 +165,7 @@ public class PDFRenderer extends PrintRenderer { } public void stopRenderer() throws IOException { - FontSetup.addToResources(this.pdfDoc, fontInfo); + FontSetup.addToResources(pdfDoc, pdfDoc.getResources(), fontInfo); pdfDoc.outputTrailer(ostream); this.pdfDoc = null; @@ -217,7 +217,7 @@ public class PDFRenderer extends PrintRenderer { (int) Math.round(w / 1000), (int) Math.round(h / 1000)); pageReferences.put(page, currentPage.referencePDF()); } - currentStream = this.pdfDoc.makeStream(); + currentStream = this.pdfDoc.makeStream(PDFStream.CONTENT_FILTER); currentState = new PDFState(); currentState.setTransform(new AffineTransform(1, 0, 0, -1, 0, (int) Math.round(pageHeight / 1000))); @@ -498,21 +498,21 @@ public class PDFRenderer extends PrintRenderer { return; } FopPDFImage pdfimage = new FopPDFImage(fopimage); - int xobj = pdfDoc.addImage(pdfimage).getXNumber(); + int xobj = pdfDoc.addImage(null, pdfimage).getXNumber(); fact.releaseImage(url, userAgent); } else if("image/jpg".equals(mime)) { if(!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) { return; } FopPDFImage pdfimage = new FopPDFImage(fopimage); - int xobj = pdfDoc.addImage(pdfimage).getXNumber(); + int xobj = pdfDoc.addImage(null, pdfimage).getXNumber(); fact.releaseImage(url, userAgent); } else { if(!fopimage.load(FopImage.BITMAP, userAgent)) { return; } FopPDFImage pdfimage = new FopPDFImage(fopimage); - int xobj = pdfDoc.addImage(pdfimage).getXNumber(); + int xobj = pdfDoc.addImage(null, pdfimage).getXNumber(); fact.releaseImage(url, userAgent); closeText(); |