]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added a save/restoreGraphicsState pair for the initial coordinate system in PDF outpu...
authorJeremias Maerki <jeremias@apache.org>
Mon, 26 Apr 2010 11:26:08 +0000 (11:26 +0000)
committerJeremias Maerki <jeremias@apache.org>
Mon, 26 Apr 2010 11:26:08 +0000 (11:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@938005 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
src/java/org/apache/fop/render/pdf/PDFRenderer.java
src/java/org/apache/fop/util/AbstractPaintingState.java
status.xml

index 6025fb486d5f77e3e5679ec547c12969d33b0877..bc2f16f450f11bc95a96a9b141d1c1ff65f5a6e9 100644 (file)
@@ -245,6 +245,7 @@ public class PDFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler {
         AffineTransform basicPageTransform = new AffineTransform(1, 0, 0, -1, 0,
                 (scaleY * size.height) / 1000f);
         basicPageTransform.scale(scaleX, scaleY);
+        generator.saveGraphicsState();
         generator.concatenate(basicPageTransform);
     }
 
@@ -259,7 +260,8 @@ public class PDFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler {
 
     /** {@inheritDoc} */
     public void endPageContent() throws IFException {
-        //nop
+        generator.restoreGraphicsState();
+        //for top-level transform to change the default coordinate system
     }
 
     /** {@inheritDoc} */
index c280ac6fbf94e31c288f568f0156fb44ae164e5b..aab84807cbfef8a6388cd334663bab12f60b3bc5 100644 (file)
@@ -495,16 +495,14 @@ public class PDFRenderer extends AbstractPathOrientedRenderer implements PDFConf
         this.borderPainter = new PDFBorderPainter(this.generator);
 
         // Transform the PDF's default coordinate system (0,0 at lower left) to the PDFRenderer's
+        saveGraphicsState();
         AffineTransform basicPageTransform = new AffineTransform(1, 0, 0, -1, 0,
                 pageHeight / 1000f);
         generator.concatenate(basicPageTransform);
-        /*
-        currentState.concatenate(basicPageTransform);
-        currentStream.add(CTMHelper.toPDFString(basicPageTransform, false) + " cm\n");
-        */
 
         super.renderPage(page);
 
+        restoreGraphicsState();
         if (accessEnabled) {
             logicalStructureHandler.endPage();
         }
index 4fb6b173c12cb5c9de04d14f2e5b7738f2b5fde5..c0c3c7fc805966ef16e55696750ba70ed88804b0 100644 (file)
@@ -513,6 +513,9 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable {
             data.fontSize = this.fontSize;
             data.lineWidth = this.lineWidth;
             data.dashArray = this.dashArray;
+            if (this.transform == null) {
+                this.transform = new AffineTransform();
+            }
             data.transform = new AffineTransform(this.transform);
             return data;
         }
index 3925cac4826c75cc8cbeff259b0ab5889aff5628..bac90b3ea46a0ed657a6668be0b3afcdd64b6e8c 100644 (file)
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="JM" type="fix">
+        Added a save/restoreGraphicsState pair for the initial coordinate system in PDF output
+        for easier post-processing.
+      </action>
       <action context="Images" dev="JM" type="add">
         Added customization ability for the image loading framework from FOP's configuration file.
       </action>