Click or drag to resize

PageObjectModel Class

The objects drawn on a page of a loaded PDF document (text, images, paths, groups and gradients), in the order they are painted. Obtained from ObjectModel. Objects can be read, moved, rotated, resized, removed, duplicated, reordered and recolored; changes are written when the document is saved.
Inheritance Hierarchy
SystemObject
  ExpertPdf.Anywhere.PdfDocumentPageObjectModel

Namespace: ExpertPdf.Anywhere.PdfDocument
Assembly: ExpertPdf.Anywhere (in ExpertPdf.Anywhere.dll) Version: 22.0
Syntax
public class PageObjectModel

The PageObjectModel type exposes the following members.

Properties
 NameDescription
Public propertyObjects Gets every object of the page in paint order (later objects are drawn over earlier ones). The children of a group (FormObject) follow it.
Top
Methods
 NameDescription
Public methodGetFormObjectsGets the groups (form XObjects) of the page, in paint order.
Public methodGetImageObjectsGets the image objects of the page, in paint order.
Public methodGetObjectsInLayerGets the objects drawn in a layer, in paint order.
Public methodGetObjectsInRectangleGets the objects (not groups) whose bounds intersect the rectangle, in paint order.
Public methodGetPathObjectsGets the path objects (lines, rectangles, curves) of the page, in paint order.
Public methodGetTextObjectsGets the text objects of the page, in paint order.
Public methodHitTestGets the topmost object (not a group) whose bounds contain the point, or null.
Top
Remarks

Coordinates are in points with the origin at the top-left corner of the page as it is displayed (after its rotation), like every other coordinate of the library.

Each change is applied to the page at once. Objects obtained earlier keep pointing at the same content after a change made through this model; when the page is changed in another way, read the objects again.

Example
Document document = new Document("in.pdf");
PageObjectModel model = document.Pages[0].ObjectModel;
foreach (TextObject text in model.GetTextObjects())
    Console.WriteLine(text.Text + " " + text.Bounds);
model.GetImageObjects()[0].Remove();
document.Save("out.pdf");
document.Close();
See Also