You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Henrik Olsson <he...@intentia.se> on 2003/04/17 10:38:59 UTC

Postscript landscape problem.

Hi, I found that my printouts in postscript (fop-maintain) always are 
printed as 'portrait' when the were suposed to be 'landscape'.
I found a pece of code in the PCLRenderer that fixt it for PCL and there 
were nothing like it in the PSRenderer.
So I have created a patch that will do the trick for the PSRenderer, and 
would be realy pleased if someone would put it in the maintaine branche.

/Henrik


from PCLRenderer
// 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;
}


new code in the PSRenderer
// Assumption that this is a landscape layout
if (page.getHeight() < page.getWidth()) {
        write(Math.round(page.getHeight() / 1000f)+" 0 translate");
        write("90 rotate");
}


Patch:


Index: PSRenderer.java
===================================================================
RCS file: 
/home/cvspublic/xml-fop/src/org/apache/fop/render/ps/Attic/PSRenderer.java,v
retrieving revision 1.15.2.15
diff -u -r1.15.2.15 PSRenderer.java
--- PSRenderer.java     2 Mar 2003 16:55:18 -0000       1.15.2.15
+++ PSRenderer.java     17 Apr 2003 08:35:56 -0000
@@ -851,6 +851,13 @@
         write("%%BeginPageSetup");
         write("FOPprocs begin");
         write("FOPFonts begin");
+ 
+        // Assumption that this is a landscape layout
+        if (page.getHeight() < page.getWidth()) {
+               write(Math.round(page.getHeight() / 1000f)+" 0 
translate");
+               write("90 rotate");
+        }
+
         write("0.001 0.001 scale");
         write("%%EndPageSetup");
         renderRegions(page);

Re: Postscript landscape problem.

Posted by Jeremias Maerki <de...@greenmail.ch>.
Ok, this is done for HEAD and maintenance branch.

In HEAD this will be activated using a configuration element
<auto-rotate-landscape>true</auto-rotate-landscape>.

In the maintenance branch you have to instantiate the PS renderer
yourself and call setAutoRotateLandscape(true):

import org.apache.fop.render.ps.PSRenderer;

PSRenderer renderer = new PSRenderer();
renderer.setAutoRotateLandscape(true);
driver.setRenderer(renderer);

That ok for you, Henrik?

On 17.04.2003 16:25:29 Jeremias Maerki wrote:
> What you propose is not always desired. You can see the FIXME for the
> PCLRenderer where there is a similar problem. I will not directly apply
> your patch but will change the PostScript renderer in a way that you can
> do what you want but without changing semantics (which your code does).
> 
> You'll hear again from me shortly. Thanks for your patience.
> 
> On 17.04.2003 10:38:59 Henrik Olsson wrote:
> > Hi, I found that my printouts in postscript (fop-maintain) always are 
> > printed as 'portrait' when the were suposed to be 'landscape'.
> > I found a pece of code in the PCLRenderer that fixt it for PCL and there 
> > were nothing like it in the PSRenderer.
> > So I have created a patch that will do the trick for the PSRenderer, and 
> > would be realy pleased if someone would put it in the maintaine branche.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Postscript landscape problem.

Posted by Jeremias Maerki <de...@greenmail.ch>.
What you propose is not always desired. You can see the FIXME for the
PCLRenderer where there is a similar problem. I will not directly apply
your patch but will change the PostScript renderer in a way that you can
do what you want but without changing semantics (which your code does).

You'll hear again from me shortly. Thanks for your patience.

On 17.04.2003 10:38:59 Henrik Olsson wrote:
> Hi, I found that my printouts in postscript (fop-maintain) always are 
> printed as 'portrait' when the were suposed to be 'landscape'.
> I found a pece of code in the PCLRenderer that fixt it for PCL and there 
> were nothing like it in the PSRenderer.
> So I have created a patch that will do the trick for the PSRenderer, and 
> would be realy pleased if someone would put it in the maintaine branche.
> 
> /Henrik
> 
> 
> from PCLRenderer
> // 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;
> }
> 
> 
> new code in the PSRenderer
> // Assumption that this is a landscape layout
> if (page.getHeight() < page.getWidth()) {
>         write(Math.round(page.getHeight() / 1000f)+" 0 translate");
>         write("90 rotate");
> }
> 
> 
> Patch:
> 
> 
> Index: PSRenderer.java
> ===================================================================
> RCS file: 
> /home/cvspublic/xml-fop/src/org/apache/fop/render/ps/Attic/PSRenderer.java,v
> retrieving revision 1.15.2.15
> diff -u -r1.15.2.15 PSRenderer.java
> --- PSRenderer.java     2 Mar 2003 16:55:18 -0000       1.15.2.15
> +++ PSRenderer.java     17 Apr 2003 08:35:56 -0000
> @@ -851,6 +851,13 @@
>          write("%%BeginPageSetup");
>          write("FOPprocs begin");
>          write("FOPFonts begin");
> + 
> +        // Assumption that this is a landscape layout
> +        if (page.getHeight() < page.getWidth()) {
> +               write(Math.round(page.getHeight() / 1000f)+" 0 
> translate");
> +               write("90 rotate");
> +        }
> +
>          write("0.001 0.001 scale");
>          write("%%EndPageSetup");
>          renderRegions(page);



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org