BufferedImage + PrinterJob

Discussion in 'Java' started by Maciek, Nov 1, 2005.

  1. Maciek

    Maciek Guest

    I try printing some pics (png)
    I try this (and other) exmaple:
    http://java.sun.com/j2se/1.4.2/docs/guide/jps/spec/appendix_2DPrinterJob.fm.html

    In method paint() used that code:
    paint(){
    [...]
    g2d.drawImage(bufferedImage, 0, 0, 100, 100, null);
    [...]
    }

    Everything goes allright as long as loaded pic to bufferedImage
    (BufferedImage) is not too big.
    But, for example, after loaded (bufferedImage = ImageIO.read(imgage))
    png file in resolution 3000x3000px and call PrinterJob.print method,
    program throw error "java.lang.OutOfMemoryError". After convert this pic
    to smaller resolution, for example 1000x2000px every thing is ok.

    Launch JVM with parameters -Xms -Xmx to allocate more memory, but it's
    not help.

    WinXP, 768MB, java1.4.2
     
    Maciek, Nov 1, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Jones
    Replies:
    0
    Views:
    576
    Steve Jones
    Feb 18, 2004
  2. Brad Grier

    Selecting Printer w/PrinterJob

    Brad Grier, Feb 19, 2004, in forum: Java
    Replies:
    0
    Views:
    413
    Brad Grier
    Feb 19, 2004
  3. Mike
    Replies:
    0
    Views:
    441
  4. Replies:
    1
    Views:
    1,319
  5. tonylaq
    Replies:
    2
    Views:
    359
    Jeffrey H. Coffield
    Aug 10, 2007
Loading...

Share This Page