PdfFileEditor Class
Implements operations with PDF file: concatenation, splitting, extracting pages, making booklet, etc.
Inheritance Hierarchy
SystemObject
  Aspose.Pdf.FacadesPdfFileEditor

Namespace: Aspose.Pdf.Facades
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 19.10
Syntax
public sealed class PdfFileEditor

The PdfFileEditor type exposes the following members.

Constructors
  NameDescription
Public methodPdfFileEditor
Initializes a new instance of the PdfFileEditor class
Properties
  NameDescription
Public propertyCode exampleAllowConcatenateExceptions
If set to true, exceptions are thrown if error occured. Else excetion are not thrown and methods return false if failed.
Public propertyAttachmentName
Gets or sets name of attachment when result of operation is stored into HttpResponse objects as attachment.
Public propertyCode exampleCloseConcatenatedStreams
If set to true, streams are closed after operation.
Public propertyConcatenationPacketSize
Number of documents concatenated before new incremental update was made during concatenation when UseDiskBuffer is set to true.
Public propertyContentDisposition
Gets or sets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.
Public propertyConversionLog
Gets log of conversion process.
Public propertyConvertTo
Sets PDF file format. Result file will be saved in specified file format. If this property is not specified then file will be save in default PDF format without conversion.
Public propertyCopyLogicalStructure
If true then logical structure of the file is copied when concatenation is performed.
Public propertyCopyOutlines
If true then outlines will be copied.
Public propertyCorruptedFileAction
This property defines behavior when concatenating process met corrupted file. Possible values are: StopWithError and ConcatenateIgnoringCorrupted.
Public propertyCode exampleCorruptedItems
Array of encountered problems when concatenation was performed. For every corrupted document from passed to Concatenate() function new CorruptedItem entry is created. This property may be used only when CorruptedFileAction is ConcatenateIgnoringCorrupted.
Examples
C#
//concatenate documents and show information about corrupted documents
PdfFileEditor pfe = new PdfFileEditor();
pfe.CorruptedFileAction = PdfFileEditor.ConcatenateCorruptedFileActions.ConcatenateIgnoringCorrupted;
if (pfe.CorruptedItems.Length >0)
{
  foreach(PdfFileEditor.CorruptedItem item in pfe.CorruptedItems)
  {
     Console.WriteLine(item.Index + " reason: " + item.Exception);
  }
}
Public propertyIncrementalUpdates
If true, incremental updates are made during concatenation.
Public propertyKeepFieldsUnique
If true then field names will be made unique when forms are concatenated. Suffixes will be added to field names, suffix template may be specified in UniqueSuffix property.
Public propertyCode exampleLastException
Gets last occured exception. May be used to check the reason of failure when AllowconcatenateExceptions = false.
Public propertyMergeDuplicateLayers
Optional contents of concatentated documents with equal names will be merged into one layer in resulstant document if this property is true. Else, layers with equal names will be save as different layers in resultant document.
Public propertyMergeDuplicateOutlines
If true, duplicate outlines are merged.
Public propertyOptimizeSize
Gets or sets optimization flag. Equal resource streams in resultant file are merged into one PDF object if this flag set. This allows to decrease resultant file size but may cause slower execution and larger memory requirements. Default value: false.
Public propertyOwnerPassword
Sets owner's password if the source input Pdf file is encrypted. This property is not implemented yet.
Public propertyPreserveUserRights
If true, user rights of first document are applied to concatenated document. User rights of all other documents are ignored.
Public propertySaveOptions
Gets or sets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.
Public propertyCode exampleUniqueSuffix
Format of the suffix which is added to field name to make it unique when forms are concatenated. This string must contain %NUM% substring which will be replaced with numbers. For example if UniqueSuffix = "ABC%NUM%" then for field "fieldName" names will be: fieldNameABC1, fieldNameABC2, fieldNameABC3 etc.
Public propertyUseDiskBuffer
If this option used then destination document will be saved on disk periodically and further concatenation will appllied to it as incremental updates.
Methods
  NameDescription
Public methodCode exampleAddMargins(Stream, Stream, Int32, Double, Double, Double, Double)
Resizes page contents and add specifed margins. Margins are specified in default space units.
Public methodCode exampleAddMargins(String, String, Int32, Double, Double, Double, Double)
Resizes page contents and add specifed margins. Margins are specified in default space units.
Public methodCode exampleAddMarginsPct(Stream, Stream, Int32, Double, Double, Double, Double)
Resizes page contents and add specified margins. Margins are specified in percents of intitial page size.
Public methodCode exampleAddMarginsPct(String, String, Int32, Double, Double, Double, Double)
Resizes page contents and add specified margins. Margins are specified in percents of intitial page size.
Public methodAddPageBreak(Stream, Stream, PdfFileEditorPageBreak)
Adds page breaks into document pages.
Public methodAddPageBreak(String, String, PdfFileEditorPageBreak)
Adds page breaks into document pages.
Public methodAddPageBreak(Document, Document, PdfFileEditorPageBreak)
Adds page breaks into document pages.
Public methodCode exampleAppend(Stream, Stream, Int32, Int32, Stream)
Appends pages,which are chosen from portStream within the range from startPage to endPage, in portStream at the end of firstInputStream.
Public methodCode exampleAppend(Stream, Stream, Int32, Int32, Stream)
Appends pages, which are chosen from array of documents in portStreams. The result document includes firstInputFile and all portStreams documents pages in the range startPage to endPage.
Public methodAppend(Stream, Stream, Int32, Int32, HttpResponse)
Appends documents to source document and saves result into response object.
Public methodCode exampleAppend(String, String, Int32, Int32, String)
Appends pages, which are chosen from portFile within the range from startPage to endPage, in portFile at the end of firstInputFile.
Public methodCode exampleAppend(String, String, Int32, Int32, String)
Appends pages, which are chosen from portFiles documents. The result document includes firstInputFile and all portFiles documents pages in the range startPage to endPage.
Public methodAppend(String, String, Int32, Int32, HttpResponse)
Appends documents to source document and saves result into HttpResponse object.
Public methodCode exampleConcatenate(Stream, Stream)
Concatenates files
Public methodConcatenate(Stream, HttpResponse)
Concatenates files and stores result into HttpResponse object.
Public methodCode exampleConcatenate(String, String)
Concatenates files into one file.
Public methodConcatenate(String, HttpResponse)
Concatenates files and saves reslt into HttpResposnse object.
Public methodConcatenate(Document, Document)
Concatenates documents.
Public methodCode exampleConcatenate(Stream, Stream, Stream)
Concatenates two files.
Public methodCode exampleConcatenate(String, String, String)
Concatentates two files.
Public methodCode exampleConcatenate(Stream, Stream, Stream, Stream)
Merges two Pdf documents into a new Pdf document with pages in alternate ways and fill the blank places with blank pages. e.g.: document1 has 5 pages: p1, p2, p3, p4, p5. document2 has 3 pages: p1', p2', p3'. Merging the two Pdf document will produce the result document with pages:p1, p1', p2, p2', p3, p3', p4, blankpage, p5, blankpage.
Public methodCode exampleConcatenate(String, String, String, String)
Merges two Pdf documents into a new Pdf document with pages in alternate ways and fill the blank places with blank pages. e.g.: document1 has 5 pages: p1, p2, p3, p4, p5. document2 has 3 pages: p1', p2', p3'. Merging the two Pdf document will produce the result document with pages:p1, p1', p2, p2', p3, p3', p4, blankpage, p5, blankpage.
Public methodCode exampleDelete(Stream, Int32, Stream)
Deletes pages specified by number array from input file, saves as a new Pdf file.
Public methodDelete(Stream, Int32, HttpResponse)
Deletes specified pages from document and saves result into HttpResponse object.
Public methodCode exampleDelete(String, Int32, String)
Deletes pages specified by number array from input file, saves as a new Pdf file.
Public methodDelete(String, Int32, HttpResponse)
Deletes specified pages from document and stores result into HttpResponse object.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodCode exampleExtract(Stream, Int32, Stream)
Extracts pages specified by number array, saves as a new Pdf file.
Public methodExtract(Stream, Int32, HttpResponse)
Extracts specified pages form source file and stores result into HttpResponse object.
Public methodCode exampleExtract(String, Int32, String)
Extracts pages specified by number array, saves as a new PDF file.
Public methodExtract(String, Int32, HttpResponse)
Extracts specified pages from source file and stores result into HttpResponse object.
Public methodCode exampleExtract(Stream, Int32, Int32, Stream)
Extracts pages from input file,saves as a new Pdf file.
Public methodCode exampleExtract(String, Int32, Int32, String)
Extracts pages from input file,saves as a new Pdf file.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodCode exampleInsert(Stream, Int32, Stream, Int32, Stream)
Inserts pages from an other file into the input Pdf file.
Public methodInsert(Stream, Int32, Stream, Int32, HttpResponse)
Inserts document into other document and stores result into response object.
Public methodCode exampleInsert(String, Int32, String, Int32, String)
Inserts pages from an other file into the input Pdf file.
Public methodInsert(String, Int32, String, Int32, HttpResponse)
Inserts contents of file into source file and stores result into HttpResponse object.
Public methodCode exampleInsert(Stream, Int32, Stream, Int32, Int32, Stream)
Inserts pages from an other file into the input Pdf file.
Public methodCode exampleInsert(String, Int32, String, Int32, Int32, String)
Inserts pages from an other file into the Pdf file at a position.
Public methodCode exampleMakeBooklet(Stream, Stream)
Makes booklet from the InputStream to outputStream.
Public methodCode exampleMakeBooklet(String, String)
Makes booklet from the input file to output file.
Public methodMakeBooklet(Stream, PageSize, HttpResponse)
Makes booklet from source file and stores result into HttpResponse.
Public methodCode exampleMakeBooklet(Stream, Stream, PageSize)
Makes booklet from the input stream and save result into output stream.
Public methodMakeBooklet(String, PageSize, HttpResponse)
Makes booklet from source file and stores result into HttpResponse objects.
Public methodCode exampleMakeBooklet(String, String, PageSize)
Makes booklet from the inputFile to outputFile.
Public methodCode exampleMakeBooklet(Stream, Stream, Int32, Int32)
Makes customized booklet from the firstInputStream to outputStream.
Public methodCode exampleMakeBooklet(String, String, Int32, Int32)
Makes customized booklet from the firstInputFile to outputFile.
Public methodMakeBooklet(Stream, PageSize, Int32, Int32, HttpResponse)
Make booklet from PDF file and stores it into HttpResponse.
Public methodCode exampleMakeBooklet(Stream, Stream, PageSize, Int32, Int32)
Makes booklet from the firstInputStream to outputStream.
Public methodMakeBooklet(String, PageSize, Int32, Int32, HttpResponse)
Makes booklet from source file and stores result into HttpResponse objects.
Public methodCode exampleMakeBooklet(String, String, PageSize, Int32, Int32)
Makes customized booklet from the firstInputFile to outputFile.
Public methodCode exampleMakeNUp(Stream, Stream, Stream)
Makes N-Up document from the two input PDF streams to outputStream.
Public methodCode exampleMakeNUp(Stream, Stream, Boolean)
Makes N-Up document from the multi input PDF streams to outputStream. Each page of outputStream will contain multi pages, which are combination with pages in the input streams of the same page number. The multi-pages piled up horizontally if isSidewise is true and piled up vertically if isSidewise is false.
Public methodCode exampleMakeNUp(String, String, String)
Makes N-Up document from the two input PDF files to outputFile. Each page of outputFile will contain two pages, one page is from the first input file and another is from the second input file. The two pages are piled up horizontally.
Public methodCode exampleMakeNUp(String, String, Boolean)
Makes N-Up document from the multi input PDF files to outputFile. Each page of outputFile will contain multi pages, which are combination with pages in the input files of the same page number. The multi pages piled up horizontally if isSidewise is true and piled up vertically if isSidewise is false.
Public methodMakeNUp(Stream, Int32, Int32, HttpResponse)
Makes N-up document and stores result into HttpResponse.
Public methodCode exampleMakeNUp(Stream, Stream, Int32, Int32)
Makes N-Up document from the input stream and saves result into output stream.
Public methodMakeNUp(String, Int32, Int32, HttpResponse)
Makes N-up document and stores result into HttpResponse.
Public methodCode exampleMakeNUp(String, String, Int32, Int32)
Makes N-Up document from the firstInputFile to outputFile.
Public methodMakeNUp(Stream, Int32, Int32, PageSize, HttpResponse)
Makes N-up document and stores result into HttpResponse object.
Public methodCode exampleMakeNUp(Stream, Stream, Int32, Int32, PageSize)
Makes N-Up document from the first input stream to output stream.
Public methodMakeNUp(String, Int32, Int32, PageSize, HttpResponse)
Makes N-up document and stores result into HttpResponse object.
Public methodCode exampleMakeNUp(String, String, Int32, Int32, PageSize)
Makes N-Up document from the input file to outputFile.
Public methodCode exampleResizeContents(Document, PdfFileEditorContentsResizeParameters)
Resizes pages of document. Blank margins are added around of shrinked page.
Public methodCode exampleResizeContents(Document, Int32, PdfFileEditorContentsResizeParameters)
Resizes pages of document. Blank margins are added around of shrinked page.
Public methodResizeContents(Stream, Int32, PdfFileEditorContentsResizeParameters, HttpResponse)
Resizes contents of pages in document. If page is shrinked blank margins are added around the page.Result is stored into HttpResponse object.
Public methodCode exampleResizeContents(Stream, Stream, Int32, PdfFileEditorContentsResizeParameters)
Resizes contents of pages of the document.
Public methodResizeContents(String, Int32, PdfFileEditorContentsResizeParameters, HttpResponse)
Resizes contents of pages in document. If page is shrinked blank margins are added around the page.Result is stored into HttpResponse object.
Public methodCode exampleResizeContents(String, String, Int32, PdfFileEditorContentsResizeParameters)
Resizes contents of pages in document. If page is shrinked blank margins are added around the page.
Public methodCode exampleResizeContents(Stream, Stream, Int32, Double, Double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New size of contents is specified in default space units.
Public methodCode exampleResizeContents(String, String, Int32, Double, Double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New size of contents is specified in default space units.
Public methodCode exampleResizeContentsPct(Stream, Stream, Int32, Double, Double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New contents size is specified in percents.
Public methodCode exampleResizeContentsPct(String, String, Int32, Double, Double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New contents size is specified in percents.
Public methodCode exampleSplitFromFirst(Stream, Int32, Stream)
Splits from start to specified location,and saves the front part in output Stream.
Public methodSplitFromFirst(Stream, Int32, HttpResponse)
Splits document from start to specified location and stores result into HttpResponse object.
Public methodCode exampleSplitFromFirst(String, Int32, String)
Splits Pdf file from first page to specified location,and saves the front part as a new file.
Public methodSplitFromFirst(String, Int32, HttpResponse)
Splits document from first page to location and saves result into HttpResponse objects.
Public methodSplitToBulks(Stream, Int32)
Splits the Pdf file into several documents.The documents can be single-page or multi-pages.
Public methodSplitToBulks(String, Int32)
Splits the Pdf file into several documents.The documents can be single-page or multi-pages.
Public methodCode exampleSplitToEnd(Stream, Int32, Stream)
Splits from specified location, and saves the rear part as a new file Stream.
Public methodSplitToEnd(Stream, Int32, HttpResponse)
Splits from specified location, and saves the rear part into HttpResponse object.
Public methodCode exampleSplitToEnd(String, Int32, String)
Splits from location, and saves the rear part as a new file.
Public methodSplitToEnd(String, Int32, HttpResponse)
Splits from specified location, and saves the rear part into HttpResponse object.
Public methodSplitToPages(Stream)
Splits the Pdf file into single-page documents.
Public methodSplitToPages(String)
Splits the PDF file into single-page documents.
Public methodSplitToPages(Stream, String)
Split the Pdf file into single-page documents and saves it into specified path. Path is specifield by field name temaplate.
Public methodSplitToPages(String, String)
Split the Pdf file into single-page documents and saves it into specified path. Path is specifield by field name temaplate.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
See Also