Greetings John,
try lower quality resolution thru java.awt.RenderingHints before printing.

---in the article <[EMAIL PROTECTED]>, John
Wells wrote:
>Hi guys.  I'm running into a problem with printing Tiffs.  While I
>realize
>that Tiffs are a JAI problem, I was told by a guy off the JAI list that
>my
>problem was more central to Java, Java2d and the Java print system than
>to
>JAI, as once the images are loaded by JAI they're bitmaps anyway, and
>that
>you might have some ideas on how to get around it.
>
>When I print Tiffs from my application, the print spool can grow quite
>large, and for some cases (50 tiffs are not uncommon in a print job) it
>can completely freeze the machine due to lack of memory.
>
>For example, I have two TIFF images that are stored in the database
>using the the DEFLATE compression at 32k and 28k, but when I print
>the images (under Windows), the overall size of the print job according
>to the Windows spooler is 42 MB.  As you can imagine, this quickly
>becomes a problem.
>
>Is there a right way to handle this?  Is there anything I can do?  I'm
>currently using the following code, any suggestions are greatly
>appreciated:
>
>public int print(Graphics pgfx, PageFormat format, int pageIdx) throws
>PrinterException {
>      if (pageIdx>=maxPages) {
>          return NO_SUCH_PAGE;
>      }
>      if (doc.getImage()!=null) {
>          // forcing this to 0 margins, because we want our printed
>image to mimic
>          // the input.
>          pgfx.translate(0, 0);
>          int formh = (int) format.getHeight();
>          int formw = (int) format.getWidth();
>          // getImage() below returns a PlanarImage
>          pgfx.drawImage(this.getImage().getAsBufferedImage(), 0, 0,
>formw, formh, this);
>          return PAGE_EXISTS;
>      } else {
>          logger.error("Trying to print null document image...");
>          return NO_SUCH_PAGE;
>      }
>  }
>
>Thanks, as always, for any insight you might provide!
>
>John
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>of the message "signoff JAVA2D-INTEREST".  For general help, send email
>to
>[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to