Hello all,

Is it possible to do the same thing with pdf?

AFAIK pdf doesn't have info about page orientation, and as a sequence, you
have to pass the orientation to the printing application (eg acrobat) so
that it prints corectly, but I need someone to assert this info..

Also, the page size (A3, A4, letter, etc..), AFAIK pdf doesn't have info
about it either. so even with the right  page sizes you cant configure your
pdf print application to choose the correct paper size form within the pdf.
again, you have to pass/set the page size into the application. right?

What about formats other than ps and pdf?

Thanks

-----Original Message-----
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: Monday, June 17, 2002 9:25 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Configuring Portrait/landscape from PSRenderer


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