You could store the data into an array of page objects, so that the call from the print job will allow you to just pull out the data by index position. But this may take up too much memory. So you might have to resort to array storage of page start and finish information, and be prepared to do some work during each page request. The java.awt.print.Pageable interface is provided to help in such complex tasks, and also to provide support for differing page format requirements for left and right hand pages in a document. It is beyond the scope of this article, but worth researching.
Powerful page formatting The page formatting can treat the page like a screen canvas.
It can cast the passed Graphics context to the powerful Graphics2D context, and unleash the power of Java 2D graphics. See the related topics for help on graphics operations that you can perform. Your application could use the same routine to format the screen display and page print format, allowing for differing dimensions of the surface in each case of course. The sequence of pages cannot be relied upon to be in numerical order. The print dialog allows variations, and page ranges, which would affect this.