aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2010-04-26 11:26:08 +0000
committerJeremias Maerki <jeremias@apache.org>2010-04-26 11:26:08 +0000
commit5b75bee76bcd92c0a9af32ca24b4f42db55686cf (patch)
treec1e90e0c8c6254f575724580fe006c27dafe40a3
parent1e649a305c5e55904afffcde5e55519d9e486f68 (diff)
downloadxmlgraphics-fop-5b75bee76bcd92c0a9af32ca24b4f42db55686cf.tar.gz
xmlgraphics-fop-5b75bee76bcd92c0a9af32ca24b4f42db55686cf.zip
Added a save/restoreGraphicsState pair for the initial coordinate system in PDF output for easier post-processing. The missing q/Q pair caused content to be upside-down when simply a new content stream is appended to the page. With this change the initial coordinate system is restored after FOP's stream is finished.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@938005 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java4
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java6
-rw-r--r--src/java/org/apache/fop/util/AbstractPaintingState.java3
-rw-r--r--status.xml4
4 files changed, 12 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
index 6025fb486..bc2f16f45 100644
--- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
+++ b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
@@ -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} */
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index c280ac6fb..aab84807c 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -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();
}
diff --git a/src/java/org/apache/fop/util/AbstractPaintingState.java b/src/java/org/apache/fop/util/AbstractPaintingState.java
index 4fb6b173c..c0c3c7fc8 100644
--- a/src/java/org/apache/fop/util/AbstractPaintingState.java
+++ b/src/java/org/apache/fop/util/AbstractPaintingState.java
@@ -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;
}
diff --git a/status.xml b/status.xml
index 3925cac48..bac90b3ea 100644
--- a/status.xml
+++ b/status.xml
@@ -58,6 +58,10 @@
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>