Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing LARGE graphics  RSS feed

 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem with printing an ENORMOUS graphic.
I've been using the JAVA2D printing API basically just to convert J2D drawing commands into postscript by calling the printing service and checking the "print to file" box on the dialogue. Some of the images are more than 500MB for a single image. (These will end up being very large scale images). The largest I could render was 1 GB, and any bigger than that and the program crashes. I even set the heap size to as big as I can without using swap memory, which is about 375MB.

What I need is a way to generate postscript incrementally, so that I don't have to pass the whole huge PrinterGraphics object all at once.

Any suggestions? Maybe I'll take a more in depth look at the printing API.
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did a little researching and was able to find a good solution.

Apache has a project called XML-Graphics-Commons that is excellent for this task. It has a class PSDocumentGraphics2D that creates postscript code. It is clever in that they implemented the AbstractGraphics2D class so that all the drawing methods are mirrored from the Graphics2D class, but the difference is that the methods are output to a given stream as postscript. For convenience I could even cast from PSDocumentGraphics2D to Graphics2D, so I didn't have to change much of anything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!