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 declares 30 methods for PdfPageEditor objects in .NET programs. Available methods include: ApplyChanges, BindPdf, Close, Dispose, GetArtBox, GetBleedBox, GetCropBox, GetPageBoxSize, GetPageRotation, GetPageSize, GetPages, GetTrimBox, and 12 additional methods. 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
DocumentDocumentReadThe currently-bound document, or throws if none.
PageSizePageSize?Read/WriteThe size to resize the target pages to when the changes are applied (ApplyChanges or Save); null leaves the page size unchanged.
HorizontalAlignmentHorizontalAlignmentRead/WriteWhere a page’s content sits horizontally on the resized page when PageSize is set: left (the default), centre or right.
VerticalAlignmentTypeVerticalAlignmentRead/WriteWhere a page’s content sits vertically on the resized page when PageSize is set: bottom (the default), centre or top.
ZoomfloatRead/WriteThe factor a page’s content is scaled by when it is resized to PageSize (1 = unscaled).
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 used to position page content within the resized media box when PageSize is set.
VerticalAlignmentVerticalAlignmentTypeRead/WriteVertical alignment used to position page content within the resized media box when PageSize is set.
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()Creates a page editor with no document bound; call BindPdf before editing.
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 to an existing Document; caller owns lifetime.
BindPdf(stream: Stream)Reads the whole stream (from the start when it is seekable) and binds that PDF for editing.
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()Applies the pending page changes to the bound document and returns it as PDF bytes.
Close()Release the bound document.
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

 English