Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When printing using java.awt.PrinterJob, why does it print each page at least twice (and sometimes much more than that)?

page print printing twice
0
Posted

When printing using java.awt.PrinterJob, why does it print each page at least twice (and sometimes much more than that)?

0

The root of this is that Java 2D printing needs to be able to print everything that Java 2D can render to the screen, and that includes translucent colours, images etc which cannot always be printed directly in Postscript or GDI except when printing everything as one big image, so the implementation tries to avoid this by calling first to discover the rendering that needs to be done for the page. If its simple opaque rendering then only one more call is needed to render the page. If there are translucent colours then multiple calls are done for “bands” down the page to limit the size of the image being generated and hence constrain peak memory usage.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.