X-Received: by 10.43.79.196 with SMTP id zr4mr7366586icb.3.1397131410520; Thu, 10 Apr 2014 05:03:30 -0700 (PDT) X-Received: by 10.50.118.37 with SMTP id kj5mr78472igb.1.1397131410430; Thu, 10 Apr 2014 05:03:30 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!ur14no5624646igb.0!news-out.google.com!gi6ni272igc.0!nntp.google.com!ur14no5624643igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.gui Date: Thu, 10 Apr 2014 05:03:29 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.176.71.30; posting-account=9dR8_AkAAABbNbQ-U_m3thlQpFbt9dlM NNTP-Posting-Host: 122.176.71.30 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Printing BufferedImage witch high resolution From: agipstech@gmail.com Injection-Date: Thu, 10 Apr 2014 12:03:30 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.java.gui:5422 On Tuesday, August 19, 2003 6:57:17 PM UTC+5:30, Andre Brunner wrote: > Hello, >=20 > I want to print a JPanel with a lot of JTextField's and some JLabels. >=20 > Therefor I created a BufferedImage of the JPanel and tried to print > it. The problem is that the resolution of the print is really bad > because when creating the BufferedImage the resolution of the screen > is used and not the printer-resolution! >=20 > My question: Is it possible to print the image with a resolution of > 600dpi or higher? >=20 > The original image is to big for one page so I have to create > subimages via BufferedImage.getSubImage(): >=20 > The source of the print-method: >=20 >=20 > public int print(Graphics gra, PageFormat pageFormat, int pageIndex) > throws PrinterException > { > mybuf =3D new BufferedImage((int) getSize().getWidth(),=20 > (int) getSize().getHeight(), BufferedImage.TYPE_INT_ARGB); >=20 > Graphics2D bufGraphics =3D mybuf.createGraphics();=20 >=20 > paint(bufGraphics); >=20 > Graphics2D graphics =3D (Graphics2D) gra; > . > . > . >=20 > subImage =3D mybuf.getSubimage((int) ((positionForWidth) * > width), (int) > (positionForHeight * height), width, height); > . > . > . > =20 > graphics.drawImage(subImage, 0, 0, null); =20 > return PAGE_EXISTS; > } > else > { > return NO_SUCH_PAGE; > } > =20 > I would be really great if someone is able to help! >=20 >=20 > Thank you very much=20 >=20 > Andr=E9