The PDF Document is built by creating a page for each page in the Area Tree.
This page then has all the contents added.
The page is then added to the document and available objects can be written to the output stream.
The contents of the page are things such as text, lines, images etc.
The PDFRenderer inserts the text directly into a pdf stream.
The text consists of markup to set fonts, set text position and add text.
Most of the simple pdf markup is inserted directly into a pdf stream.
Other more complex objects or commonly used objects are added through java classes.
Some pdf objects such as an image consists of two parts.
It has a separate object for the image data and another bit of markup to display the image in a certain position on the page.
The java objects that represent a pdf object implement a method that returns the markup for inserting into a stream.
The method is: byte toPDF().