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?


-----Original Message-----
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: Monday, June 17, 2002 9:25 PM
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

    public void renderPage(Page page) {
        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("FOPprocs begin");
        write("FOPFonts begin");
        if (page.getHeight() < page.getWidth()) {
            write("90 rotate");
            write("0 -" + ph + " translate");
        write("0.001 0.001 scale");
        body = page.getBody();
        before = page.getBefore();
        after = page.getAfter();
        if (before != null) {
        if (after != null) {
        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

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 !

Jeremias Maerki

Reply via email to