| This is the base high-level representation of a PDF object; all specialized objects
(e.g. Document, Page, Pages, ContentStream...) inherit from it.
Remarks
Somebody may wonder why I didn't directly make specialized objects inherit from
their low-level counterparts (e.g. Page extends PdfDictionary, ContentStream
extends PdfStream and so on): that could have been much smoother anyway, you argue.
Yeah, I could agree if there was a plain one-to-one mapping between primitive PDF
types and specialized instances, but (you know!) reality is not so polished as
theory: the 'Content' entry of Page dictionaries may be a simple reference to a
PdfStream or a PdfArray of references to PdfStream-s, Pages collections may be
spread across a B-tree instead of a flat PdfArray etc. So: in order to hide all
these annoying inner workings, I chose to adopt a composition pattern instead of
the apparently-reasonable (but actually awkward!) inheritance pattern.
Nonetheless, users are always enabled to navigate through the low-level structure
accessing the
PdfObjectWrapper.getBaseDataObject() method.
|