diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-08-03 06:43:45 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-08-03 06:43:45 +0000 |
commit | 5f8f50a231df8ed65706ffc3860c4bfda365dab7 (patch) | |
tree | f342bc61b8e972218ba89d566695f92c51e41863 /src/java/org | |
parent | 44cef15e6fe271b103630fd09fd0c91e8d680552 (diff) | |
download | xmlgraphics-fop-5f8f50a231df8ed65706ffc3860c4bfda365dab7.tar.gz xmlgraphics-fop-5f8f50a231df8ed65706ffc3860c4bfda365dab7.zip |
Reverted rev 798521.
Reason: Loss of accuracy. PDF is operating at points rather than millipoints. Especially when it comes to prepress features people will want exact sizes in the target PDFs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@800217 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFFactory.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFPage.java | 24 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index f3b7732f9..a8d7a0702 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -20,7 +20,6 @@ package org.apache.fop.pdf; // Java -import java.awt.Rectangle; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.FileNotFoundException; @@ -184,8 +183,8 @@ public class PDFFactory { * @return the created /Page object */ public PDFPage makePage(PDFResources resources, int pageIndex, - Rectangle mediaBox, Rectangle cropBox, - Rectangle bleedBox, Rectangle trimBox) { + Rectangle2D mediaBox, Rectangle2D cropBox, + Rectangle2D bleedBox, Rectangle2D trimBox) { PDFPage page = new PDFPage(resources, pageIndex, mediaBox, cropBox, bleedBox, trimBox); getDocument().assignObjectNumber(page); @@ -207,7 +206,7 @@ public class PDFFactory { */ public PDFPage makePage(PDFResources resources, int pageWidth, int pageHeight, int pageIndex) { - Rectangle mediaBox = new Rectangle(0, 0, pageWidth, pageHeight); + Rectangle2D mediaBox = new Rectangle2D.Double(0, 0, pageWidth, pageHeight); return makePage(resources, pageIndex, mediaBox, mediaBox, mediaBox, mediaBox); } diff --git a/src/java/org/apache/fop/pdf/PDFPage.java b/src/java/org/apache/fop/pdf/PDFPage.java index 7a2029ffc..4fa3b0a09 100644 --- a/src/java/org/apache/fop/pdf/PDFPage.java +++ b/src/java/org/apache/fop/pdf/PDFPage.java @@ -19,7 +19,7 @@ package org.apache.fop.pdf; -import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; /** * Class representing a /Page object. @@ -45,8 +45,8 @@ public class PDFPage extends PDFResourceContext { * @param trimBox the TrimBox. If null, bleedBox is used. */ public PDFPage(PDFResources resources, int pageIndex, - Rectangle mediaBox, Rectangle cropBox, - Rectangle bleedBox, Rectangle trimBox) { + Rectangle2D mediaBox, Rectangle2D cropBox, + Rectangle2D bleedBox, Rectangle2D trimBox) { /* generic creation of object */ super(resources); @@ -56,8 +56,8 @@ public class PDFPage extends PDFResourceContext { this.pageIndex = pageIndex; } - private void setSimplePageSize(Rectangle mediaBox, Rectangle cropBox, - Rectangle bleedBox, Rectangle trimBox) { + private void setSimplePageSize(Rectangle2D mediaBox, Rectangle2D cropBox, + Rectangle2D bleedBox, Rectangle2D trimBox) { setMediaBox(mediaBox); if (cropBox == null) { @@ -76,16 +76,16 @@ public class PDFPage extends PDFResourceContext { setTrimBox(trimBox); //Needed for PDF/X } - private PDFArray toPDFArray(Rectangle box) { - return new PDFArray(this, new int[] { - box.x, box.y, box.x + box.width, box.y + box.height}); + private PDFArray toPDFArray(Rectangle2D box) { + return new PDFArray(this, new double[] { + box.getX(), box.getY(), box.getMaxX(), box.getMaxY()}); } /** * Sets the "MediaBox" entry * @param box the media rectangle */ - public void setMediaBox(Rectangle box) { + public void setMediaBox(Rectangle2D box) { put("MediaBox", toPDFArray(box)); } @@ -93,7 +93,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "CropBox" entry * @param box the bleed rectangle */ - public void setCropBox(Rectangle box) { + public void setCropBox(Rectangle2D box) { put("CropBox", toPDFArray(box)); } @@ -101,7 +101,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "BleedBox" entry * @param box the bleed rectangle */ - public void setBleedBox(Rectangle box) { + public void setBleedBox(Rectangle2D box) { put("BleedBox", toPDFArray(box)); } @@ -109,7 +109,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "TrimBox" entry * @param box the trim rectangle */ - public void setTrimBox(Rectangle box) { + public void setTrimBox(Rectangle2D box) { put("TrimBox", toPDFArray(box)); } |