From bee6652fc92ed1286342555ad540690399f17686 Mon Sep 17 00:00:00 2001 From: Steve Coffman Date: Tue, 11 Jul 2000 18:42:00 +0000 Subject: [PATCH] This adds Domagoj Cosic's patch to fix printing to Postscript printers, etc. If you've had problems, please test and let fop-dev know if it still occurs, as there's one or two other places that this might not cover. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193486 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/pdf/PDFRenderer.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 757c1e125..0cfea8eab 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -188,12 +188,15 @@ public class PDFRenderer implements Renderer { * @param g the green component * @param b the blue component */ - protected void addLine(int x1, int y1, int x2, int y2, int th, PDFPathPaint stroke) + protected void addLine(int x1, int y1, int x2, int y2, int th, + PDFPathPaint stroke) { - currentStream.add(stroke.getColorSpaceOut(false)); - currentStream.add(th / 1000f + " w\n"); - addLine(x1/1000f, y1/1000f, x2/1000f, y2/1000f, false); - currentStream.add("0 G\n"); + currentStream.add("ET\nq\n" + + stroke.getColorSpaceOut(false) + + (x1/1000f) + " "+ (y1/1000f) + " m " + + (x2/1000f) + " "+ (y2/1000f) + " l " + + (th / 1000f) + " w S\n" + + "Q\nBT\n"); } /** @@ -279,10 +282,11 @@ public class PDFRenderer implements Renderer { */ protected void addRect(int x, int y, int w, int h, PDFPathPaint stroke) { - currentStream.add(stroke.getColorSpaceOut(false) + currentStream.add("ET\nq\n" + + stroke.getColorSpaceOut(false) + (x/1000f) + " " + (y/1000f) + " " - + (w/1000f) + " " + (h/1000f) + " re S\n" - + "0 G\n"); + + (w/1000f) + " " + (h/1000f) + " re s\n" + + "Q\nBT\n"); } /** @@ -298,13 +302,12 @@ public class PDFRenderer implements Renderer { protected void addRect(int x, int y, int w, int h, PDFPathPaint stroke, PDFPathPaint fill) { - currentStream.add(fill.getColorSpaceOut(true) + currentStream.add("ET\nq\n" + + fill.getColorSpaceOut(true) + stroke.getColorSpaceOut(false) + (x/1000f) + " " + (y/1000f) + " " - + (w/1000f) + " " + (h/1000f) + " re S\n" - + (x/1000f) + " " + (y/1000f) + " " - + (w/1000f) + " " + (h/1000f) + " re f\n" - + "0 g\n"); + + (w/1000f) + " " + (h/1000f) + " re b\n" + + "Q\nBT\n"); } protected void addPath(Vector points, int posx, int posy, boolean fill) -- 2.39.5