Page
Overview
Page is a class in Aspose.PDF FOSS for .NET.
Inherits from: IDisposable.
Represents a page in a PDF document.
This class provides 53 methods for working with Page objects in .NET programs.
Available methods include: Accept, AddContent, AddContentStream, AddExtGState, AddFloatingBox, AddGraph, AddGraphics, AddImage, AddStamp, AddTable, AsByteArray, AsXml, and 27 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Actions, Annotations, ArtBox, Artifacts, Background, BackgroundImage, and 34 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Number | int | Read | 1-based page number. |
FieldsInTabOrder | IList<Forms.Field> | Read | Form fields whose widgets appear on this page, ordered by their tab order. |
Rect | Rectangle | Read/Write | Page rectangle (defaults to MediaBox). |
Rectangle | Rectangle | Read/Write | The page rectangle. |
PageInfo | PageInfo | Read/Write | Page info container with width/height/margin properties. |
Background | Color? | Read/Write | Gets or sets the background. |
MediaBox | Rectangle | Read/Write | The media box for this page (required per spec). |
CropBox | Rectangle | Read/Write | The crop box (defaults to media box). |
BleedBox | Rectangle | Read/Write | The bleed box (defaults to crop box). |
TrimBox | Rectangle | Read/Write | The trim box (defaults to crop box). |
ArtBox | Rectangle | Read/Write | The art box (defaults to crop box). |
Rotate | Rotation | Read/Write | Page rotation as Rotation enum. |
RotateDegrees | int | Read/Write | Page rotation in degrees as int (0, 90, 180, 270). |
RotationMatrix | Matrix | Read | Affine transform that maps the unrotated PDF coordinate system to the page’s user-visible (rotated) one. |
Duration | double | Read/Write | Page display duration in seconds for presentation mode. |
Annotations | AnnotationCollection | Read | Annotations on this page. |
Images | XImageCollection | Read | Image XObjects on this page. |
Fonts | FontCollection | Read | Fonts referenced by this page. |
Resources | Resources | Read | Page resources (fonts, images) — provides access via a unified Resources object. |
Patterns | IReadOnlyDictionary<string, Pattern> | Read | Pattern resources on this page (keyed by pattern name). |
Contents | OperatorCollection | Read | Content stream operator collection. |
Width | double | Read | Visible page width accounting for rotation. |
Height | double | Read | Visible page height accounting for rotation. |
ColorType | ColorType | Read | Gets the color type of this page by analyzing its content stream operators and image color spaces. |
Transition | PageTransition? | Read | The page transition effect, or null if none is set. |
Header | HeaderFooter? | Read/Write | Header to render at the top of this page. |
Footer | HeaderFooter? | Read/Write | Footer to render at the bottom of this page. |
TocInfo | TocInfo? | Read/Write | TOC information for this page. |
Paragraphs | Paragraphs | Read/Write | Collection of paragraph objects to add to this page (TextFragment, HtmlFragment, Table, Heading, etc.). |
NoteLineStyle | GraphInfo | Read/Write | Default stroke/fill style used to draw footnote / endnote separator lines. |
Artifacts | ArtifactCollection | Read | Collection for adding artifacts (watermarks, etc.) to this page. |
OcgLayers | LayerCollection | Read | Gets the layers (Optional Content Groups) referenced by this page. |
Actions | PageActionCollection | Read | Per-page additional actions (open / close / etc.). |
UserUnit | double | Read/Write | User-unit factor (PDF 32000 §14.8.4 /UserUnit entry). |
IsAddParagraphsAfterLast | bool | Read/Write | Whether Paragraphs additions append at the end (vs flow position). |
BackgroundImage | Image? | Read/Write | Page background image. |
Group | Group? | Read/Write | Group / blending colour space dictionary for this page. |
TabOrder | TabOrder | Read/Write | Tab order (PDF 32000 §12.5 /Tabs entry). |
Watermark | Watermark? | Read/Write | Watermark applied to this page. |
Layers | System.Collections.Generic.List<Layer> | Read/Write | Real-effective layer list backed by OcgLayers — every OCG referenced by the page is materialised as a Layer instance. |
Methods
| Signature | Description |
|---|---|
SetRotation(degrees: int) | Set the page rotation in degrees (0, 90, 180, 270). |
SetMediaBox(rect: Rectangle) | Set the media box for this page. |
SetCropBox(rect: Rectangle) | Set the crop box for this page. |
SetBleedBox(rect: Rectangle) | Set the bleed box for this page. |
SetTrimBox(rect: Rectangle) | Set the trim box for this page. |
SetArtBox(rect: Rectangle) | Set the art box for this page. |
Accept(visitor: Annotations.AnnotationSelector) | Walk every annotation on this page through visitor; matches accumulate in Selected. |
GetResources() | Method-style accessor for Resources. |
SetPageSize(width: double, height: double) | Set the page size by updating the MediaBox. |
GetPageRect(considerRotation: bool) | Get the page rectangle, optionally considering the CropBox. |
Accept(visitor: Text.TextAbsorber) | Accept a TextAbsorber visitor (matching the public API). |
GetText() | Extract all text from the page using a TextAbsorber. |
Accept(visitor: Text.TextFragmentAbsorber) | Accept a TextFragmentAbsorber visitor (matching the public API). |
Accept(visitor: ImagePlacementAbsorber) | Accept an ImagePlacementAbsorber visitor (matching the public API). |
SendTo(device: Devices.ImageDevice, outputFileName: string) | Add a stamp to this page. |
SendTo(device: Devices.ImageDevice, output: Stream) | Render this page using the specified device and write to a stream. |
AddStamp(stamp: ImageStamp) | Apply an image stamp to this page. |
AddStamp(stamp: Aspose.Pdf.Stamps.Stamp) | Calls AddStamp on this Page instance. |
AddContentStream(contentBytes: byte[]) | Append a content stream to this page. |
PrependContentStream(contentBytes: byte[]) | Prepend content stream bytes before existing page content (for background elements). |
AddContent(contentStreamBytes: byte[]) | Append content stream bytes to this page. |
AddTable(table: Table) | Add a table to this page. |
AddGraph(graph: Drawing.Graph) | Add a graph (collection of shapes) to this page. |
AddFloatingBox(box: FloatingBox) | Add a floating box to this page. |
AddExtGState(extGState: Content.ExtGState) | Add an ExtGState dictionary to this page’s resources and return the resource name. |
AddImage(imageData: byte[], rect: Rectangle) | Add an image to this page at the specified position and size. |
AddImage(imageStream: Stream, rect: Rectangle) | Add an image from a stream to this page at the specified position and size. |
AddImage(imagePath: string, rectangle: Rectangle) | Add an image from a file path at the specified rectangle. |
AddImage(imageStream: Stream, imageRect: Rectangle, bbox: Rectangle, autoAdjustRectangle: bool) | Add an image at imageRect with an explicit bounding-box. |
AddImage(imageStream: Stream, imageRect: Rectangle, imageWidth: int, imageHeight: int, saveImageProportions: bool, bbox: Rectangle) | Add an image with explicit pixel size + bbox. |
AddImage(hocr: string, imageStream: Stream, imageRect: Rectangle, bbox: Rectangle) | Add an image accompanied by an HOCR (OCR overlay) string. |
Resize(targetSize: Aspose.Pdf.PageSize) | Resize this page to targetSize via media-box update. |
AsByteArray(resolution: Aspose.Pdf.Devices.Resolution) | Render this page into a PNG byte array at the requested resolution. |
Flatten() | Flatten all annotations on this page — render their visual appearance into the page content stream and remove them from the annotations array. |
ConvertToPNGMemoryStream() | Determines whether the page is blank (has no meaningful content). |
IsBlank(fillThresholdFactor: double) | Calls IsBlank on this Page instance. |
MergeLayers(newLayerName: string) | Merge all layers on this page into a single layer with the given name. |
MergeLayers(newLayerName: string, newOptionalContentGroupId: string) | Merge all layers on this page, assigning the new OCG the given id. |
HasVectorGraphics() | Whether this page contains any vector graphics. |
TrySaveVectorGraphics(pathToSave: string) | Save vector graphics from this page to pathToSave. |
AsXml() | Diagnostic XML representation of this page. |
GetNotifications() | Saver-supplied notification text emitted while rendering this page. |
MakeGrayscale() | Convert every coloured fill/stroke on this page to greyscale. |
IntToRotation(rotation: int) | Convert a degrees-int rotation to Rotation. |
RotationToInt(rotation: Rotation) | Convert Rotation to degrees as an int. |
FreeMemory() | Clears cached data. |
Dispose() | Frees up memory. |
CalculateContentBBox() | Compute the smallest axis-aligned rectangle in page space enclosing all painted content on this page (text, vector paths, images, inline images, recursively through Form XObjects). |
SendTo(device: PageDevice, output: Stream) | Render this page through a PageDevice to a stream. |
SendTo(device: PageDevice, outputFileName: string) | Render this page through a PageDevice to a file. |
AddStamp(stamp: Stamp) | Apply stamp via its Put(Page) override. |
AddGraphics(elements: GraphicElementCollection, rectangle: Rectangle) | Vector-element emission is not implemented — the renderer doesn’t yet consume GraphicElementCollection. |
DeleteGraphics(elementsToDelete: GraphicElementCollection) | Same — vector-element removal isn’t wired. |