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

NameTypeAccessDescription
NumberintRead1-based page number.
FieldsInTabOrderIList<Forms.Field>ReadForm fields whose widgets appear on this page, ordered by their tab order.
RectRectangleRead/WritePage rectangle (defaults to MediaBox).
RectangleRectangleRead/WriteThe page rectangle.
PageInfoPageInfoRead/WritePage info container with width/height/margin properties.
BackgroundColor?Read/WriteGets or sets the background.
MediaBoxRectangleRead/WriteThe media box for this page (required per spec).
CropBoxRectangleRead/WriteThe crop box (defaults to media box).
BleedBoxRectangleRead/WriteThe bleed box (defaults to crop box).
TrimBoxRectangleRead/WriteThe trim box (defaults to crop box).
ArtBoxRectangleRead/WriteThe art box (defaults to crop box).
RotateRotationRead/WritePage rotation as Rotation enum.
RotateDegreesintRead/WritePage rotation in degrees as int (0, 90, 180, 270).
RotationMatrixMatrixReadAffine transform that maps the unrotated PDF coordinate system to the page’s user-visible (rotated) one.
DurationdoubleRead/WritePage display duration in seconds for presentation mode.
AnnotationsAnnotationCollectionReadAnnotations on this page.
ImagesXImageCollectionReadImage XObjects on this page.
FontsFontCollectionReadFonts referenced by this page.
ResourcesResourcesReadPage resources (fonts, images) — provides access via a unified Resources object.
PatternsIReadOnlyDictionary<string, Pattern>ReadPattern resources on this page (keyed by pattern name).
ContentsOperatorCollectionReadContent stream operator collection.
WidthdoubleReadVisible page width accounting for rotation.
HeightdoubleReadVisible page height accounting for rotation.
ColorTypeColorTypeReadGets the color type of this page by analyzing its content stream operators and image color spaces.
TransitionPageTransition?ReadThe page transition effect, or null if none is set.
HeaderHeaderFooter?Read/WriteHeader to render at the top of this page.
FooterHeaderFooter?Read/WriteFooter to render at the bottom of this page.
TocInfoTocInfo?Read/WriteTOC information for this page.
ParagraphsParagraphsRead/WriteCollection of paragraph objects to add to this page (TextFragment, HtmlFragment, Table, Heading, etc.).
NoteLineStyleGraphInfoRead/WriteDefault stroke/fill style used to draw footnote / endnote separator lines.
ArtifactsArtifactCollectionReadCollection for adding artifacts (watermarks, etc.) to this page.
OcgLayersLayerCollectionReadGets the layers (Optional Content Groups) referenced by this page.
ActionsPageActionCollectionReadPer-page additional actions (open / close / etc.).
UserUnitdoubleRead/WriteUser-unit factor (PDF 32000 §14.8.4 /UserUnit entry).
IsAddParagraphsAfterLastboolRead/WriteWhether Paragraphs additions append at the end (vs flow position).
BackgroundImageImage?Read/WritePage background image.
GroupGroup?Read/WriteGroup / blending colour space dictionary for this page.
TabOrderTabOrderRead/WriteTab order (PDF 32000 §12.5 /Tabs entry).
WatermarkWatermark?Read/WriteWatermark applied to this page.
LayersSystem.Collections.Generic.List<Layer>Read/WriteReal-effective layer list backed by OcgLayers — every OCG referenced by the page is materialised as a Layer instance.

Methods

SignatureDescription
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.

See Also