PdfFileEditor
Overview
PdfFileEditor is a class in Aspose.PDF FOSS for .NET.
Real-only additions to PdfFileEditor: exception-handling state, Try* wrappers around the existing working methods, and MemoryStream/file overloads for SplitToBulks/SplitToPages that wrap the real byte[] implementations already present in PdfFileEditor.cs.
This class provides 117 methods for working with PdfFileEditor objects in .NET programs.
Available methods include: AddMargins, AddMarginsPct, AddPageBreak, Append, Concatenate, Delete, Extract, Insert, MakeBooklet, MakeNUp, ResizeContents, ResizeContentsPct, and 15 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: AllowConcatenateExceptions, AllowExceptions, CloseConcatenatedStreams, ConcatenationPacketSize, ConversionLog, ConvertTo, and 19 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
AllowExceptions | bool | Read/Write | When true, Try* methods propagate exceptions; when false (the default) they capture the exception in LastException and return false. |
LastException | Exception? | Read | Last exception captured by a Try* method, or null. |
RemoveSignatures | bool | Read/Write | When true, signatures present in the inputs are stripped from the Concatenate output. |
OwnerPassword | string | Read/Write | When non-empty, Concatenate outputs are encrypted with this owner password (AES-128) after the merge completes. |
KeepActions | bool | Read/Write | When true, Concatenate honours document-level /AA actions on the inputs and copies them onto the output catalog. |
MergeDuplicateLayers | bool | Read/Write | When true, identical optional-content groups in the inputs are deduplicated in the Concatenate output. |
PreserveUserRights | bool | Read/Write | When true, the Concatenate output retains /UR usage-rights entries from the inputs. |
UniqueSuffix | string | Read/Write | Suffix used to disambiguate form-field names when KeepFieldsUnique is true. |
ConversionLog | string | Read | Diagnostic log emitted by the most recent Concatenate / ConvertTo pass. |
ConvertTo | PdfFormat | Read/Write | Target PDF/A format for the next Concatenate output. |
CorruptedItems | CorruptedItem[] | Read | Items the Concatenate path skipped over because their input failed to parse. |
AllowConcatenateExceptions | bool | Read/Write | Obsolete property kept for API compatibility. |
CopyLogicalStructure | bool | Read/Write | Mirrors PdfFileEditor.CopyLogicalStructure. |
CopyOutlines | bool | Read/Write | Mirrors PdfFileEditor.CopyOutlines. |
CorruptedFileAction | ConcatenateCorruptedFileAction | Read/Write | Mirrors PdfFileEditor.CorruptedFileAction. |
CloseConcatenatedStreams | bool | Read/Write | When true, the stream-based Concatenate / Append / Insert overloads dispose the input streams (and the output stream after writing) once the operation completes. |
KeepFieldsUnique | bool | Read/Write | When true, Concatenate renames colliding form-field names in the inputs so the output has unique field names. |
MergeDuplicateOutlines | bool | Read/Write | When true, identical outline entries from the inputs are merged in the output instead of duplicated. |
IncrementalUpdates | bool | Read/Write | When true, Concatenate appends pages to the destination using PDF incremental updates instead of rewriting the entire file. |
OptimizeSize | bool | Read/Write | When true, Concatenate runs an optimization pass on the output before saving. |
ConcatenationPacketSize | int | Read/Write | Buffer-size hint (bytes) used by streaming Concatenate implementations. |
UseDiskBuffer | bool | Read/Write | When true, Concatenate buffers intermediate pages on disk instead of in memory. |
E_EMPTY_PAGE_RANGE | string | Read | Error message for null/empty page ranges. |
E_SMALL_PAGE_RANGE | string | Read | Error message for a page range with fewer than 2 elements. |
E_WRONG_PAGE_RANGE | string | Read | Error message for a page range where start > end. |
Methods
| Signature | Description |
|---|---|
TryAppend(inputFile: string, portFiles: string[], startPage: int, endPage: int, outputFile: string) | Calls TryAppend on this PdfFileEditor instance. |
TryAppend(inputStream: Stream, portStreams: Stream[], startPage: int, endPage: int, outputStream: Stream) | |
TryConcatenate(inputFiles: string[], outputFile: string) | Calls TryConcatenate on this PdfFileEditor instance. |
TryConcatenate(firstInputFile: string, secInputFile: string, outputFile: string) | |
TryConcatenate(firstInputFile: string, secInputFile: string, blankPageFile: string, outputFile: string) | |
TryConcatenate(inputStream: Stream[], outputStream: Stream) | |
TryConcatenate(firstInputStream: Stream, secInputStream: Stream, blankPageStream: Stream, outputStream: Stream) | |
TryConcatenate(src: Document[], dest: Document) | |
TryDelete(inputFile: string, pageNumber: int[], outputFile: string) | Calls TryDelete on this PdfFileEditor instance. |
TryDelete(inputStream: Stream, pageNumber: int[], outputStream: Stream) | |
TryExtract(inputFile: string, startPage: int, endPage: int, outputFile: string) | Calls TryExtract on this PdfFileEditor instance. |
TryExtract(inputFile: string, pageNumber: int[], outputFile: string) | |
TryExtract(inputStream: Stream, pageNumber: int[], outputStream: Stream) | |
TryInsert(inputFile: string, insertLocation: int, portFile: string, pageNumber: int[], outputFile: string) | Calls TryInsert on this PdfFileEditor instance. |
TryInsert(inputStream: Stream, insertLocation: int, portStream: Stream, pageNumber: int[], outputStream: Stream) | |
TryMakeBooklet(inputFile: string, outputFile: string) | Calls TryMakeBooklet on this PdfFileEditor instance. |
TryMakeBooklet(inputFile: string, outputFile: string, pageSize: PageSize) | |
TryMakeBooklet(inputFile: string, outputFile: string, leftPages: int[], rightPages: int[]) | |
TryMakeBooklet(inputFile: string, outputFile: string, pageSize: PageSize, leftPages: int[], rightPages: int[]) | |
TrySplitFromFirst(inputFile: string, location: int, outputFile: string) | Calls TrySplitFromFirst on this PdfFileEditor instance. |
TrySplitFromFirst(inputStream: Stream, location: int, outputStream: Stream) | |
TrySplitToEnd(inputFile: string, location: int, outputFile: string) | Calls TrySplitToEnd on this PdfFileEditor instance. |
TrySplitToEnd(inputStream: Stream, location: int, outputStream: Stream) | |
TryResizeContents(source: string, destination: string, pages: int[], parameters: ContentsResizeParameters) | Calls TryResizeContents on this PdfFileEditor instance. |
TryResizeContents(source: Stream, destination: Stream, pages: int[], parameters: ContentsResizeParameters) | |
TryResizeContents(source: Stream, destination: Stream, pages: int[], newWidth: double, newHeight: double) | |
TryMakeBooklet(inputStream: Stream, outputStream: Stream) | |
TryMakeBooklet(inputStream: Stream, outputStream: Stream, pageSize: PageSize) | |
TryMakeBooklet(inputStream: Stream, outputStream: Stream, leftPages: int[], rightPages: int[]) | |
TryMakeBooklet(inputStream: Stream, outputStream: Stream, pageSize: PageSize, leftPages: int[], rightPages: int[]) | |
TryMakeNUp(firstInputFile: string, secondInputFile: string, outputFile: string) | Calls TryMakeNUp on this PdfFileEditor instance. |
TryMakeNUp(inputFile: string, outputFile: string, x: int, y: int) | |
TryMakeNUp(inputFile: string, outputFile: string, x: int, y: int, pageSize: PageSize) | |
TryMakeNUp(inputFiles: string[], outputFile: string, isSidewise: bool) | |
TryMakeNUp(firstInputStream: Stream, secondInputStream: Stream, outputStream: Stream) | |
TryMakeNUp(inputStream: Stream, outputStream: Stream, x: int, y: int) | |
TryMakeNUp(inputStream: Stream, outputStream: Stream, x: int, y: int, pageSize: PageSize) | |
TryMakeNUp(inputStreams: Stream[], outputStream: Stream, isSidewise: bool) | |
ResizeContents(source: string, destination: string, pages: int[], parameters: ContentsResizeParameters) | Calls ResizeContents on this PdfFileEditor instance. |
ResizeContents(source: Stream, destination: Stream, pages: int[], parameters: ContentsResizeParameters) | |
ResizeContents(source: string, destination: string, pages: int[], newWidth: double, newHeight: double) | |
ResizeContents(source: Stream, destination: Stream, pages: int[], newWidth: double, newHeight: double) | |
ResizeContentsPct(source: string, destination: string, pages: int[], newWidth: double, newHeight: double) | Calls ResizeContentsPct on this PdfFileEditor instance. |
ResizeContentsPct(source: Stream, destination: Stream, pages: int[], newWidth: double, newHeight: double) | |
AddMargins(source: string, destination: string, pages: int[], leftMargin: double, rightMargin: double, topMargin: double, bottomMargin: double) | Calls AddMargins on this PdfFileEditor instance. |
AddMargins(source: Stream, destination: Stream, pages: int[], leftMargin: double, rightMargin: double, topMargin: double, bottomMargin: double) | |
AddMarginsPct(source: string, destination: string, pages: int[], leftMargin: double, rightMargin: double, topMargin: double, bottomMargin: double) | Calls AddMarginsPct on this PdfFileEditor instance. |
AddMarginsPct(source: Stream, destination: Stream, pages: int[], leftMargin: double, rightMargin: double, topMargin: double, bottomMargin: double) | |
MakeBooklet(inputStream: Stream, outputStream: Stream) | Calls MakeBooklet on this PdfFileEditor instance. |
MakeBooklet(inputStream: Stream, outputStream: Stream, pageSize: PageSize) | |
MakeBooklet(inputStream: Stream, outputStream: Stream, leftPages: int[], rightPages: int[]) | |
MakeBooklet(inputStream: Stream, outputStream: Stream, pageSize: PageSize, leftPages: int[], rightPages: int[]) | |
MakeNUp(inputFile: string, outputFile: string, x: int, y: int) | Calls MakeNUp on this PdfFileEditor instance. |
MakeNUp(inputFile: string, outputFile: string, x: int, y: int, pageSize: PageSize) | |
MakeNUp(inputStream: Stream, outputStream: Stream, x: int, y: int) | |
MakeNUp(inputStream: Stream, outputStream: Stream, x: int, y: int, pageSize: PageSize) | |
MakeNUp(firstInputFile: string, secondInputFile: string, outputFile: string) | |
MakeNUp(firstInputStream: Stream, secondInputStream: Stream, outputStream: Stream) | |
MakeNUp(inputFiles: string[], outputFile: string, isSidewise: bool) | |
MakeNUp(inputStreams: Stream[], outputStream: Stream, isSidewise: bool) | |
SplitToBulks(inputFile: string, numberOfPage: int[][]) | Calls SplitToBulks on this PdfFileEditor instance. |
SplitToBulks(inputStream: Stream, numberOfPage: int[][]) | |
SplitToPages(inputStream: Stream) | Calls SplitToPages on this PdfFileEditor instance. |
SplitToPages(inputFile: string, fileNameTemplate: string) | |
SplitToPages(inputStream: Stream, fileNameTemplate: string) | |
Concatenate(inputFiles) | Concatenate multiple PDF documents into one. |
Extract(inputPdf: byte[], startPage: int, endPage: int) | Extract pages from a PDF document. |
Split(inputPdf: byte[]) | Split a PDF into individual page files. |
Delete(inputPdf: byte[], pageNumbers) | Delete pages from a PDF. |
Extract(inputPdf: byte[], pageNumbers: int[]) | Extract specific pages (by page number array) from a PDF. |
SplitFromFirst(inputPdf: byte[], pageCount: int) | Extract the first N pages from a PDF. |
SplitToEnd(inputPdf: byte[], startPage: int) | Extract pages from startPage to the end of the document. |
SplitToPages(inputPdf: byte[]) | Split a PDF into individual single-page documents (alias for Split). |
SplitToPages(inputFile: string) | Split a PDF file at the given path into MemoryStreams, one per page . |
SplitToBulks(inputPdf: byte[], pageRanges: int[][]?) | Split a PDF into multiple parts based on page ranges. |
MakeBooklet(inputPdf: byte[]) | Create a booklet from a PDF. |
MakeBooklet(inputPdf: byte[], pageSize: PageSize) | Create a booklet from a PDF using a specified page size. |
MakeBooklet(inputPdf: byte[], leftPages: int[], rightPages: int[]) | Create a booklet using only specified left and right pages. |
MakeBooklet(inputPdf: byte[], pageSize: PageSize, leftPages: int[], rightPages: int[]) | Create a booklet using specified left/right pages and a custom page size. |
Append(inputPdf: byte[], portPdf: byte[], startPage: int, endPage: int) | Append pages from a source PDF to an input PDF. |
Append(inputPdf: byte[], portPdfs: byte[][], startPage: int, endPage: int) | Append pages from multiple source PDFs to an input PDF. |
Insert(inputPdf: byte[], insertLocation: int, portPdf: byte[], startPage: int, endPage: int) | Insert pages from a source PDF into a destination PDF at a given position. |
Insert(inputPdf: byte[], insertLocation: int, portPdf: byte[], pageNumbers: int[]) | Insert specific pages from a source PDF into a destination PDF at a given position. |
ResizeContents(source: Document, parameters: ContentsResizeParameters) | Resize the contents of all pages in a document by applying a scale/translate transform derived from the margin parameters. |
ResizeContents(source: Document, pages: int[], parameters: ContentsResizeParameters) | Resize the contents of specific pages in a document by applying a scale/translate transform derived from the margin parameters. |
Concatenate(inputFiles: string[], outputFile: string) | Concatenate multiple PDF files into one output file. |
Concatenate(firstInputFile: string, secInputFile: string, outputFile: string) | Concatenate two PDF files into one output file. |
Concatenate(firstInputFile: string, secInputFile: string, blankPageFile: string, outputFile: string) | Concatenate two PDF files with a blank-page separator inserted between them. |
SplitFromFirst(inputFile: string, location: int, outputFile: string) | Split from first N pages and write to output file. |
SplitToEnd(inputFile: string, location: int, outputFile: string) | Split from startPage to end and write to output file. |
Extract(inputFile: string, pageNumber: int[], outputFile: string) | Extract specific pages from a PDF file and write to output file. |
Extract(inputFile: string, startPage: int, endPage: int, outputFile: string) | Extract a range of pages from a PDF file and write to output file. |
Extract(inputStream: Stream, startPage: int, endPage: int, outputStream: Stream) | Extract a range of pages from a stream and write to an output stream . |
Concatenate(inputStream: Stream[], outputStream: Stream) | Concatenate multiple PDF streams into one output stream. |
Concatenate(firstInputStream: Stream, secInputStream: Stream, outputStream: Stream) | Concatenate two PDF streams into one output stream. |
Concatenate(firstInputStream: Stream, secInputStream: Stream, blankPageStream: Stream, outputStream: Stream) | Concatenate two PDF streams with a blank-page separator inserted between them. |
Concatenate(src: Document[], dest: Document) | Concatenate the pages of src into the existing dest document. |
AddPageBreak(src: Document, dest: Document, pageBreaks: PageBreak[]) | Copy every source page into destination, splitting any source page that is referenced by one or more PageBreak entries into separate destination pages whose MediaBoxes describe the horizontal band each page occupies in the original. |
AddPageBreak(src: Stream, dest: Stream, pageBreaks: PageBreak[]) | Stream overload of AddPageBreak(Document, Document, PageBreak[]). |
AddPageBreak(src: string, dest: string, pageBreaks: PageBreak[]) | File-path overload of AddPageBreak(Document, Document, PageBreak[]). |
Append(inputStream: Stream, portStreams: Stream[], startPage: int, endPage: int, outputStream: Stream) | Append pages from source stream(s) to input stream and write to output. |
Append(inputStream: Stream, portStream: Stream, startPage: int, endPage: int, outputStream: Stream) | Append pages from a single source stream to input stream and write to output. |
Insert(inputStream: Stream, insertLocation: int, portStream: Stream, startPage: int, endPage: int, outputStream: Stream) | Insert pages from source stream into input stream at given position. |
Insert(inputStream: Stream, insertLocation: int, portStream: Stream, pageNumber: int[], outputStream: Stream) | Insert specific pages from source stream into input stream. |
Extract(inputStream: Stream, pageNumber: int[], outputStream: Stream) | Extract specific pages from a stream and write to output stream. |
Delete(inputStream: Stream, pageNumber: int[], outputStream: Stream) | Delete specific pages from a stream and write to output stream. |
SplitFromFirst(inputStream: Stream, location: int, outputStream: Stream) | Split a stream from the first page up to pageCount. |
SplitToEnd(inputStream: Stream, location: int, outputStream: Stream) | Split a stream from startPage to the end. |
Delete(inputFile: string, pageNumber: int[], outputFile: string) | Delete specific pages from a PDF file and write to output file. |
Insert(inputFile: string, insertLocation: int, portFile: string, startPage: int, endPage: int, outputFile: string) | Insert pages from a source PDF into a destination PDF at a given position and write to output file. |
Insert(inputFile: string, insertLocation: int, portFile: string, pageNumber: int[], outputFile: string) | Insert specific pages from a source PDF into a destination PDF at a given position and write to output file. |
Append(inputFile: string, portFiles: string[], startPage: int, endPage: int, outputFile: string) | Append pages from multiple source PDF files to an input PDF and write to output file. |
Append(inputFile: string, portFile: string, startPage: int, endPage: int, outputFile: string) | Append pages from a single source PDF file to an input PDF and write to output file. |
MakeBooklet(inputFile: string, outputFile: string) | MakeBooklet from file path to file path. |
MakeBooklet(inputFile: string, outputFile: string, pageSize: PageSize) | MakeBooklet from file path to file path with a specific page size. |
MakeBooklet(inputFile: string, outputFile: string, leftPages: int[], rightPages: int[]) | MakeBooklet from file path to file path with left/right page arrays. |
MakeBooklet(inputFile: string, outputFile: string, pageSize: PageSize, leftPages: int[], rightPages: int[]) | MakeBooklet from file path to file path with page size and left/right page arrays. |