๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1063

Re: How to set printable area and reduce the margin area

#1063
From: Antonio
Date: Fri, 31 May 2002 12:18
58 lines
2876 bytes
At last I have used a PageFormat, because the problems wasn't the paper
size...

    PageFormat myFormat = new PageFormat();
    /* Let the user choose a paper size and orientation.   */
     Paper myPaper = new Paper();
     myPaper.setSize(210,297); // DIN A4
     myPaper.setImageableArea(28,28,154,241); // margin
     myFormat.setPaper(myPaper);
     myFormat = printerJob.pageDialog(myFormat);

    Book book = new Book();
    book.append(new print_mydocument(), myFormat);


Thanks
Antonio

"Joi Ellis [TeamB]" <joi@aravox.com> escribi๏ฟฝ en el mensaje
news:3cf6008d_1@dnews...
> Antonio <avazquez@winsoftsystems.com> wrote:
> > I have a print routine that draws a rectangle with de width and height
of
> > page:
>
> > public int print(Graphics g, PageFormat pf, int pi) throws
PrinterException
> > {
> >         if (pi >= 1)
> >             return Printable.NO_SUCH_PAGE;
>
> >         Graphics2D g2 = (Graphics2D) g;
> >         g2.setColor(red);
> >         g2.drawRect((int) pf.getImageableX() + 1
> >                    ,(int) pf.getImageableY() + 1
> >                    ,(int) pf.getImageableWidth()
> >                    ,(int) pf.getImageableHeight());
>
> >         return Printable.PAGE_EXISTS;
> > }
>
> > The problem is that the margin space is too wide in a DIN A4 page...How
can
> > I reduce the margin space?
>
> Well, I'm guessing Java defaults to using US-standard paper sizes, and A4
is
> a non-US standard size.  Have you told the print "stuff" to change the
paper
> size before sending your image?
>
> --
> Joi Ellis (TeamB)               http://www.teamb.com/
> No direct email, please.
> For best results, post on news server newsgroups.borland.com!
> Newsgroup Guidelines: http://www.borland.com/newsgroups/guide.html
> Only posts which violate the rules in guide.html are subject to
cancelation.
Technical Details
Message-ID: <3cf7695b_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!news-hub.siol.net!feed.cgocable.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3cf5faa6_2@dnews> <3cf6008d_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,aff152e741f2b0ed
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-05-31 05:26:23 PST
From: "Antonio" <avazquez@winsoftsystems.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3cf5faa6_2@dnews> <3cf6008d_1@dnews>
Subject: Re: How to set printable area and reduce the margin area
Date: Fri, 31 May 2002 14:18:26 +0200
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 62.174.36.236
Message-ID: <3cf7695b_1@dnews>
X-Trace: dnews 1022847323 62.174.36.236 (31 May 2002 05:15:23 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!news-hub.siol.net!feed.cgocable.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews