PdfPageEditor
Overview
PdfPageEditor is a class in Aspose.PDF FOSS for .NET.
Inherits from: System.IDisposable.
Facade for page-level editing: rotation, resizing, margin adjustment, and page box manipulation (CropBox, TrimBox, BleedBox, ArtBox).
This class provides 30 methods for working with PdfPageEditor objects in .NET programs.
Available methods include: ApplyChanges, BindPdf, Close, Dispose, GetArtBox, GetBleedBox, GetCropBox, GetPageBoxSize, GetPageRotation, GetPageSize, GetPages, GetTrimBox, and 12 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Alignment, BLINDH, BLINDV, BTWIPE, DGLITTER, DISSOLVE, and 23 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Document | Document | Read | Save the bound document and return PDF bytes. |
PageSize | PageSize? | Read/Write | Page size to apply to subsequent operations (no-op stored). |
HorizontalAlignment | HorizontalAlignment | Read/Write | Horizontal alignment for subsequent operations (no-op stored). |
VerticalAlignmentType | VerticalAlignment | Read/Write | Vertical alignment for subsequent operations (no-op stored). |
Zoom | float | Read/Write | Zoom factor for subsequent operations (no-op stored). |
Rotation | int | Read/Write | Get or set page rotation in degrees (0, 90, 180, 270). |
DisplayDuration | int | Read/Write | Get or set the display duration (in seconds) for the pages in the bound document. |
Alignment | AlignmentType | Read/Write | Horizontal-alignment hint for content positioning. |
VerticalAlignment | VerticalAlignmentType | Read/Write | Vertical-alignment hint for content positioning. |
PageRotations | Dictionary<int, int> | Read/Write | Per-page rotation map, keyed by 1-based page number with rotation in degrees (0/90/180/270). |
ProcessPages | int[]? | Read/Write | 1-based page numbers that subsequent stateful operations apply to. |
TransitionType | int | Read/Write | Transition style code (use the static constants on this class). |
TransitionDuration | int | Read/Write | Transition effect duration in seconds (PDF /Trans /D). |
SPLITVOUT | int | Read | Gets the splitvout. |
SPLITHOUT | int | Read | Gets the splithout. |
SPLITVIN | int | Read | Gets the splitvin. |
SPLITHIN | int | Read | Gets the splithin. |
BLINDV | int | Read | Gets the blindv. |
BLINDH | int | Read | Gets the blindh. |
INBOX | int | Read | Gets the inbox. |
OUTBOX | int | Read | Gets the outbox. |
LRWIPE | int | Read | Gets the lrwipe. |
RLWIPE | int | Read | Gets the rlwipe. |
BTWIPE | int | Read | Gets the btwipe. |
TBWIPE | int | Read | Gets the tbwipe. |
DISSOLVE | int | Read | Gets the dissolve. |
LRGLITTER | int | Read | Gets the lrglitter. |
TBGLITTER | int | Read | Gets the tbglitter. |
DGLITTER | int | Read | Gets the dglitter. |
Methods
| Signature | Description |
|---|---|
PdfPageEditor() | Calls PdfPageEditor on this PdfPageEditor instance. |
PdfPageEditor(document: Document) | Bind directly at construction time. |
BindPdf(path: string) | Bind a PDF file by path for editing. |
BindPdf(pdfData: byte[]) | Bind PDF data for editing. |
BindPdf(srcDoc: Document) | Bind a PDF stream for editing. |
BindPdf(stream: Stream) | Calls BindPdf on this PdfPageEditor instance. |
Save(outputFile: string) | Save the bound document to a file. |
Save(outputStream: Stream) | Save the bound document to a stream. |
ApplyChanges() | Apply queued changes to the bound document — resizes the target pages when PageSize is set. |
Save() | Calls Save on this PdfPageEditor instance. |
Close() | Release the bound document, completing the BindPdf / Save / Close lifecycle. |
Dispose() | IDisposable implementation; delegates to Close. |
GetPages() | Number of pages in the bound document. |
GetPageRotation(page: int) | 1-based page rotation in degrees (0/90/180/270). |
GetPageSize(page: int) | 1-based page size, derived from the page MediaBox. |
GetPageBoxSize(page: int, pageBoxName: string) | Return the named page-box rectangle as Rectangle. |
MovePosition(moveX: float, moveY: float) | Record a translation offset (in points) for subsequent operations. |
RotatePages(input: byte[], rotation: int, pageNumbers) | Rotate specified pages. |
SetRotation(input: byte[], rotation: int, pageNumbers) | Set the rotation of specified pages to an absolute value. |
ResizePages(input: byte[], newMediaBox: Rectangle, pageNumbers) | Resize specified pages to a new media box. |
SetCropBox(input: byte[], pageNumber: int, rect: Rectangle) | Set the CropBox (visible area) on a specific page. |
SetTrimBox(input: byte[], pageNumber: int, rect: Rectangle) | Set the TrimBox (intended finished page size after trimming) on a specific page. |
SetBleedBox(input: byte[], pageNumber: int, rect: Rectangle) | Set the BleedBox (region to which content should be clipped when printed) on a specific page. |
SetArtBox(input: byte[], pageNumber: int, rect: Rectangle) | Set the ArtBox (meaningful content area) on a specific page. |
SetMargins(input: byte[], pageNumber: int, left: double, bottom: double, right: double, top: double) | Adjust page margins by modifying the CropBox relative to the MediaBox. |
GetCropBox(input: byte[], pageNumber: int) | Get the CropBox for a specific page. |
GetTrimBox(input: byte[], pageNumber: int) | Get the TrimBox for a specific page. |
GetBleedBox(input: byte[], pageNumber: int) | Get the BleedBox for a specific page. |
GetArtBox(input: byte[], pageNumber: int) | Get the ArtBox for a specific page. |
ScalePage(input: byte[], pageNumber: int, scaleX: double, scaleY: double) | Scale page content by adjusting the MediaBox dimensions. |