I've put together a code snippet for you which rotates the pages so they
should come out fine on your PS printer. I've modified the
PSRenderer.java from 0.20.4rc. It shouldn't be hard to adapt the changes
to an older version if necessary.

This is the new renderPage() method in
org.apache.fop.render.ps.PSRenderer.java:

    public void renderPage(Page page) {
        this.pagecount++;
        this.idReferences = page.getIDReferences();

        int pw = Math.round(page.getWidth() / 1000f);
        int ph = Math.round(page.getHeight() / 1000f);

        BodyAreaContainer body;
        AreaContainer before, after;
        write("%%Page: " + page.getNumber() + " " + page.getNumber());
        if (page.getHeight() > page.getWidth()) {
            write("%%PageBoundingBox: 0 0 " + pw + " " + ph);
            write("%%PageOrientation: Portrait");
        } else {
            write("%%PageBoundingBox: 0 0 " + ph + " " + pw);
            write("%%PageOrientation: Landscape");
        }
        write("%%BeginPageSetup");
        write("FOPprocs begin");
        write("FOPFonts begin");
        if (page.getHeight() < page.getWidth()) {
            write("90 rotate");
            write("0 -" + ph + " translate");
        }
        write("0.001 0.001 scale");
        write("%%EndPageSetup");
        body = page.getBody();
        before = page.getBefore();
        after = page.getAfter();
        if (before != null) {
            renderAreaContainer(before);
        }
        renderBodyAreaContainer(body);
        if (after != null) {
            renderAreaContainer(after);
        }
        write("showpage");
        write("%%PageTrailer");
        write("%%EndPage"); //This is non-standard, but used by Adobe.
    }


I won't commit this change before the final release of 0.20.4, so you'll
have to patch your code until then. Since this changes the sematics of
the PS renderer I will make some further modifications to make this
configurable.

Tell me if this worked for you. And as payment for my service I'd like
to know what printer you're going to print on. :-)

On 17.06.2002 09:52:35 Amine AMAR wrote:
> Thank's for the answer, but i want to control the printer so that it does 
> print in landscape. when changing the page height and width, the printer 
> still prints in portait !


Cheers,
Jeremias Maerki

Reply via email to