Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5422
| Newsgroups | comp.lang.java.gui |
|---|---|
| Date | 2014-04-10 05:03 -0700 |
| References | <b02c5255.0308190527.6abf1998@posting.google.com> |
| Message-ID | <e95a79fe-820e-498c-ac1a-a7edf5f3a2b5@googlegroups.com> (permalink) |
| Subject | Re: Printing BufferedImage witch high resolution |
| From | agipstech@gmail.com |
On Tuesday, August 19, 2003 6:57:17 PM UTC+5:30, Andre Brunner wrote:
> Hello,
>
> I want to print a JPanel with a lot of JTextField's and some JLabels.
>
> 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!
>
> My question: Is it possible to print the image with a resolution of
> 600dpi or higher?
>
> The original image is to big for one page so I have to create
> subimages via BufferedImage.getSubImage():
>
> The source of the print-method:
>
>
> public int print(Graphics gra, PageFormat pageFormat, int pageIndex)
> throws PrinterException
> {
> mybuf = new BufferedImage((int) getSize().getWidth(),
> (int) getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
>
> Graphics2D bufGraphics = mybuf.createGraphics();
>
> paint(bufGraphics);
>
> Graphics2D graphics = (Graphics2D) gra;
> .
> .
> .
>
> subImage = mybuf.getSubimage((int) ((positionForWidth) *
> width), (int)
> (positionForHeight * height), width, height);
> .
> .
> .
>
> graphics.drawImage(subImage, 0, 0, null);
> return PAGE_EXISTS;
> }
> else
> {
> return NO_SUCH_PAGE;
> }
>
> I would be really great if someone is able to help!
>
>
> Thank you very much
>
> André
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar
Re: Printing BufferedImage witch high resolution agipstech@gmail.com - 2014-04-10 05:03 -0700 Re: Printing BufferedImage witch high resolution Knute Johnson <eternal@knutejohnson.com> - 2014-04-12 16:54 -0700
csiph-web