PdfFileEditor.TryAppend

TryAppend(Stream, Stream[], int, int, 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 bool TryAppend(Stream inputStream, Stream[] portStreams, int startPage, int endPage, 
    Stream outputStream)
ParameterTypeDescription
inputStreamStreamInput Pdf stream.
portStreamsStream[]Documents to copy pages from.
startPageInt32Page starts in portStreams documents.
endPageInt32Page ends in portStreams documents .
outputStreamStreamOutput Pdf stream.

Return Value

True for success, or false.

Remarks

The TryAppend method is like the Append method, except the TryAppend method does not throw an exception if the operation fails.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
Stream instream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
Stream stream1 = new FileStream("file1.pdf", FileMode.Open, FileAccess.Read);
Stream stream2 = new FileStream("file2.pdf", FileMode.Open, FileAccess.Read);
Stream outstream = new FileStream("outfile.pdf", FileMode.Create, FileAccess.Write);
bool result = fileEditor.TryAppend(instream, new Stream[] { stream1, stream2}, 3, 5, outstream);

See Also


TryAppend(string, string[], int, int, 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 bool TryAppend(string inputFile, string[] portFiles, int startPage, int endPage, 
    string outputFile)
ParameterTypeDescription
inputFileStringInput Pdf file.
portFilesString[]Documents to copy pages from.
startPageInt32Page starts in portFiles documents.
endPageInt32Page ends in portFiles documents .
outputFileStringOutput Pdf document.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

The TryAppend method is like the Append method, except the TryAppend method does not throw an exception if the operation fails.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
bool result = fileEditor.TryAppend("input.pdf", new string[] { "file1.pdf", "file2.pdf"}, 3, 5, "outfile.pdf");

See Also


TryAppend(Stream, Stream[], int, int, HttpResponse)

Appends documents to source document and saves result into response object.

public bool TryAppend(Stream inputStream, Stream[] portStreams, int startPage, int endPage, 
    HttpResponse response)
ParameterTypeDescription
inputStreamStreamStream which contains source document.
portStreamsStream[]Array of streams with documents to be appended.
startPageInt32Start page of appended page.
endPageInt32End page of appended pages.
responseHttpResponseResponse object where document will be saved.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

The TryAppend method is like the Append method, except the TryAppend method does not throw an exception if the operation fails.

See Also


TryAppend(string, string[], int, int, HttpResponse)

Appends documents to source document and saves result into HttpResponse object.

public bool TryAppend(string inputFile, string[] portFiles, int startPage, int endPage, 
    HttpResponse response)
ParameterTypeDescription
inputFileStringName of file containing source document.
portFilesString[]Array of file names containing appended documents.
startPageInt32Start page of appended pages.
endPageInt32End page of appended pages.
responseHttpResponseResponse object where document will be saved.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

The TryAppend method is like the Append method, except the TryAppend method does not throw an exception if the operation fails.

See Also