07.13.07

Rendering models of Java 2D Printing API

Posted in Programming at 9:07 pm

There are two rendering models used by Java Printing API.

Printable

Printable model is the simplest. Using this model, you can implement only one Printable class. At the moment of printing, its print( ) method is called for each page. This model has the following characteristics:

  • Every page have the same PageFormat, thus it is not possible to mix landscape and portrait orientations.
  • If a print dialog is exhibited, it is not possible to know before how many pages the document will have.
  • Pages will be requested always in order, from index 0 to N – 1.
  • Printable implementation tells the printing system when the document ends, by means of Printable.NO_SUCH_PAGE constant.

Pageable

Pageable model works like a set of pages to be printed. Each page can have a different page painter. There is already a predefined implementation of this model: Book class.

This model has the following characteristics:

  • Different pages can use different PageFormat objects; hence it is possible to mix in the same document pages with portrait and landscape layout.
  • Printing system can call page painters in an arbitrary way. So you can request the printing of just some pages.

3 Comments »

  1. Search engine marketing said,

    07.17.07 at 11:02 am

    interesting

  2. Tarun K Juyal said,

    07.18.07 at 8:29 am

    Aftergone through this blog i am very impressed. But I am also write some information about Global Warming

  3. Blog Drive-Bys for 2007-07-18 - Untwisted Vortex said,

    10.31.07 at 5:20 pm

    [...] programming language that I refuse to learn is Java (not JavaScript). Leo at SEORemake wrote about two rendering models used by the Java Printing API. I'm glad it's all Greek [...]

RSS feed for comments on this post · TrackBack URL

Leave a Comment