From db4f3b282c3c02db5e4a712a40eff4c897a85b13 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 11 Jan 2008 09:04:28 +0000 Subject: Bugfix: Some string objects were not encrypted (for example in named destinations) I had to refactor the PDF library a little bit but since it only affects the inner API it shouldn't be a problem that I removed some methods which caused trouble because a didn't think about encryption when I worked on the PDF library last year. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@611114 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/render/pdf/FopPDFImage.java | 6 +----- src/java/org/apache/fop/render/pdf/PDFRenderer.java | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/java/org/apache/fop/render') diff --git a/src/java/org/apache/fop/render/pdf/FopPDFImage.java b/src/java/org/apache/fop/render/pdf/FopPDFImage.java index c9b0e3a7b..e60c207d6 100644 --- a/src/java/org/apache/fop/render/pdf/FopPDFImage.java +++ b/src/java/org/apache/fop/render/pdf/FopPDFImage.java @@ -25,6 +25,7 @@ import java.io.OutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.image.EPSImage; import org.apache.fop.image.FopImage; import org.apache.fop.image.TIFFImage; @@ -237,11 +238,6 @@ public class FopPDFImage implements PDFImage { return maskRef; } - /** {@inheritDoc} */ - public String getSoftMask() { - return softMask.toInlinePDFString(); - } - /** {@inheritDoc} */ public PDFReference getSoftMaskReference() { return softMask; diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 2d8e7d5ba..f4aa5ee90 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -37,7 +37,15 @@ import java.util.Map; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; +import org.w3c.dom.Document; + import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.CountingOutputStream; + +import org.apache.xmlgraphics.xmp.Metadata; +import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter; +import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema; + import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; @@ -86,6 +94,7 @@ import org.apache.fop.pdf.PDFInfo; import org.apache.fop.pdf.PDFLink; import org.apache.fop.pdf.PDFMetadata; import org.apache.fop.pdf.PDFNumber; +import org.apache.fop.pdf.PDFNumsArray; import org.apache.fop.pdf.PDFOutline; import org.apache.fop.pdf.PDFOutputIntent; import org.apache.fop.pdf.PDFPage; @@ -102,10 +111,6 @@ import org.apache.fop.render.Graphics2DAdapter; import org.apache.fop.render.RendererContext; import org.apache.fop.util.CharUtilities; import org.apache.fop.util.ColorProfileUtil; -import org.apache.xmlgraphics.xmp.Metadata; -import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter; -import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema; -import org.w3c.dom.Document; /** * Renderer that renders areas to PDF. @@ -357,7 +362,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { this.pdfDoc.getInfo().setTitle(userAgent.getTitle()); this.pdfDoc.getInfo().setKeywords(userAgent.getKeywords()); this.pdfDoc.setFilterMap(filterMap); - this.pdfDoc.outputHeader(stream); + this.pdfDoc.outputHeader(ostream); //Setup encryption if necessary PDFEncryptionManager.setupPDFEncryption(encryptionParams, this.pdfDoc); @@ -725,11 +730,12 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { pageLabels = this.pdfDoc.getFactory().makePageLabels(); this.pdfDoc.getRoot().setPageLabels(pageLabels); } - PDFDictionary dict = new PDFDictionary(); + PDFNumsArray nums = pageLabels.getNums(); + PDFDictionary dict = new PDFDictionary(nums); dict.put("P", page.getPageNumberString()); //TODO If the sequence of generated page numbers were inspected, this could be //expressed in a more space-efficient way - pageLabels.getNums().put(page.getPageIndex(), dict); + nums.put(page.getPageIndex(), dict); } /** -- cgit v1.2.3