PdfPageEditor

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

NameTypeAccessDescription
DocumentDocumentReadSave the bound document and return PDF bytes.
PageSizePageSize?Read/WritePage size to apply to subsequent operations (no-op stored).
HorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment for subsequent operations (no-op stored).
VerticalAlignmentTypeVerticalAlignmentRead/WriteVertical alignment for subsequent operations (no-op stored).
ZoomfloatRead/WriteZoom factor for subsequent operations (no-op stored).
RotationintRead/WriteGet or set page rotation in degrees (0, 90, 180, 270).
DisplayDurationintRead/WriteGet or set the display duration (in seconds) for the pages in the bound document.
AlignmentAlignmentTypeRead/WriteHorizontal-alignment hint for content positioning.
VerticalAlignmentVerticalAlignmentTypeRead/WriteVertical-alignment hint for content positioning.
PageRotationsDictionary<int, int>Read/WritePer-page rotation map, keyed by 1-based page number with rotation in degrees (0/90/180/270).
ProcessPagesint[]?Read/Write1-based page numbers that subsequent stateful operations apply to.
TransitionTypeintRead/WriteTransition style code (use the static constants on this class).
TransitionDurationintRead/WriteTransition effect duration in seconds (PDF /Trans /D).
SPLITVOUTintReadGets the splitvout.
SPLITHOUTintReadGets the splithout.
SPLITVINintReadGets the splitvin.
SPLITHINintReadGets the splithin.
BLINDVintReadGets the blindv.
BLINDHintReadGets the blindh.
INBOXintReadGets the inbox.
OUTBOXintReadGets the outbox.
LRWIPEintReadGets the lrwipe.
RLWIPEintReadGets the rlwipe.
BTWIPEintReadGets the btwipe.
TBWIPEintReadGets the tbwipe.
DISSOLVEintReadGets the dissolve.
LRGLITTERintReadGets the lrglitter.
TBGLITTERintReadGets the tbglitter.
DGLITTERintReadGets the dglitter.

Methods

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

See Also