From 8dba990fe7760458b1cd2d4bb0f7287ac33b5978 Mon Sep 17 00:00:00 2001 From: Christian Geisert Date: Tue, 26 Nov 2002 18:15:18 +0000 Subject: [PATCH] Added autoselecting portrait/landscape on PCL Renderer (see bug #6638) Submitted by: vicentesalvador@netscape.net (Vicente Salvador) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195629 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 2 ++ .../apache/fop/render/pcl/PCLRenderer.java | 25 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 164ce79ff..ae15f71a6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ ============================================================================== Done since 0.20.4 release +- Added autoselecting portrait/landscape on PCL Renderer (see bug #6638) + Submitted by: vicentesalvador@netscape.net (Vicente Salvador) - Improved AWT Font-measuring/rendering (see bug #14657) Submitted by: Ralph LaChance - Updated examples/fo files to remove all errors and warnings during build diff --git a/src/org/apache/fop/render/pcl/PCLRenderer.java b/src/org/apache/fop/render/pcl/PCLRenderer.java index ba52bfee1..f77b8678e 100755 --- a/src/org/apache/fop/render/pcl/PCLRenderer.java +++ b/src/org/apache/fop/render/pcl/PCLRenderer.java @@ -48,8 +48,7 @@ public class PCLRenderer extends PrintRenderer { public int curdiv = 0; private int divisions = -1; public int paperheight = -1; // Paper height in decipoints? - public int orientation = - -1; // -1=default/unknown, 0=portrait, 1=landscape. + public int orientation = 0; // 0=default/portrait, 1=landscape. public int topmargin = -1; // Top margin in decipoints? public int leftmargin = -1; // Left margin in decipoints? private int fullmargin = 0; @@ -677,6 +676,18 @@ public class PCLRenderer extends PrintRenderer { System.out.println("PCLRenderer.renderPage() page.Height() = " + page.getHeight()); + // FIXME: Set orientation. We made this assumption. It's not always correct but we need a + // method to generate landscape pages + if (page.getHeight() < page.getWidth()) { + orientation = 1; + } + currentStream.add("\033&l" + orientation + "O"); + if (orientation == 1 || orientation == 3) { + xoffset = -144; + } else { + xoffset = -180; + } + if (paperheight > 0 && divisions == -1) divisions = paperheight / (page.getHeight() / 100); @@ -750,16 +761,6 @@ public class PCLRenderer extends PrintRenderer { log.info("rendering areas to PCL"); currentStream = new PCLStream(outputStream); - // Set orientation. - if (orientation > -1) - currentStream.add("\033&l" + orientation + "O"); - else - currentStream.add("\033&l0O"); - if (orientation == 1 || orientation == 3) - xoffset = -144; - else - xoffset = -180; - // Reset the margins. currentStream.add("\033" + "9\033&l0E"); } -- 2.39.5