aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/render/pdf/PDFRenderer.java
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-08-30 10:09:03 +0000
committerKeiron Liddle <keiron@apache.org>2001-08-30 10:09:03 +0000
commit348228dd57dbce827a48bfdafb4fa700b2ea5a8c (patch)
treeddb5b86cf36fa92d5e3d5cd17eb7dc77ee099618 /src/org/apache/fop/render/pdf/PDFRenderer.java
parente0f188c784787183e904380600233cb46b8277ff (diff)
downloadxmlgraphics-fop-348228dd57dbce827a48bfdafb4fa700b2ea5a8c.tar.gz
xmlgraphics-fop-348228dd57dbce827a48bfdafb4fa700b2ea5a8c.zip
handles viewbox and no svg size better
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194446 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render/pdf/PDFRenderer.java')
-rw-r--r--src/org/apache/fop/render/pdf/PDFRenderer.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java
index 6cec91dd0..e4ae8f056 100644
--- a/src/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/org/apache/fop/render/pdf/PDFRenderer.java
@@ -387,6 +387,7 @@ public class PDFRenderer extends PrintRenderer {
SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);
+
float sx = 1, sy = -1;
int xOffset = x, yOffset = y;
@@ -412,6 +413,17 @@ public class PDFRenderer extends PrintRenderer {
currentStream.add(sx + " 0 0 " + sy + " " + xOffset / 1000f + " "
+ yOffset / 1000f + " cm\n");
+ AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w / 1000f, h / 1000f);
+ if(!at.isIdentity()) {
+ double[] vals = new double[6];
+ at.getMatrix(vals);
+ currentStream.add(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " cm\n");
+ }
UserAgent userAgent = new MUserAgent(new AffineTransform());