Document Object Model (DOM) is a form of representation of structured documents as an object-oriented model. DOM is the official World Wide Web Consortium (W3C) standard for representing structured documents in a platform- and language-neutral manner.
In simple words, DOM is a tree of objects that represent the structure of some document. Aspose.Pdf also uses the idea of DOM to represent the structure of a PDF document in terms of objects.
The top level structure of the DOM of Aspose.Pdf is shown in the diagram below:
|
The root of the object model is the Document object. It has a collection of Sections. Each Section has Headers,Footers and a collection of Paragraphs. Each Header or Footer has a collection of Paragraphs.
So, the ultimate thing required to create PDF documents is the Paragraph But a paragraph can have different types of data to present in a PDF document. Let's have a look on the Paragraph and its specializations.
Paragraph
Paragraph is an abstract class in Aspose.Pdf which acts as a template or model for its successors. Paragraph abstract class has some common properties such as Margin, IsFirstParagraph etc. shared among its child classes. You should not instantiate Paragraph objects directly and add them into Section.
Paragraph specializations are:
The structure of Paragraph is shown in the diagram below:
|
Some of the important objects in Paragraph DOM Hierarchy are described below:
Floating Box
Coming with Aspose.Pdf v2.8, a Floating box is a box that contains one or more paragraphs. Floating box is positioned by customer but not by the page render engine. Four enumerates BoxHorizontalPositioning BoxHorizontalAlignment BoxVerticalPositioning and BoxVerticalAlignment is used to control the position of floating box.
Text
A Text paragraph has one or more Segments . A Segment is a part of text that has the same format (that is Font Size, Color etc). If you want to use different text formats in a Text paragraph, Multiple Segments with different formats can be embedded in a Text paragraph.
The Text structure in Aspose.Pdf is shown in the diagram below:
|
Graph
A Graph has a collection of Shapes . Shape is an abstract class and it specializations are:
The Graph structure in Aspose.Pdf is shown in the diagram below:
|
Table
A Table has a collection of Rows . A Row has a collection of Cells . A Cell has a collection of Paragraphs . A Cell can span more than one columns. Table can be nested.
The Table structure in Aspose.Pdf is shown in the diagram below:
|
Form Field
Every Form has some fields. The data resides in those fields in some specified format. A Form Field has a collection of Fields . Form Field constitutes the following types that are supported by Aspose.Pdf :
Note: You can refer to the XML schema for all classes and properties which can be used in XML and Aspose.Pdf API Reference for all classes and properties which can be used in API.