PdfFileEditor.TryInsert

TryInsert(string, int, string, int[], string)

Inserts pages from an other file into the input Pdf file.

public bool TryInsert(string inputFile, int insertLocation, string portFile, int[] pageNumber, 
    string outputFile)
ParameterTypeDescription
inputFileStringInput Pdf file.
insertLocationInt32Insert position in input file.
portFileStringPages from the Pdf file.
pageNumberInt32[]The page number of the ported in portFile.
outputFileStringOutput Pdf file.

Return Value

True for success, or false.

Remarks

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

Examples

PdfFileEditor pfe = new PdfFileEditor();
bool result = pfe.TryInsert("file1.pdf", 1, "file2.pdf", new int[] { 2, 6 }, "out.pdf");

See Also


TryInsert(Stream, int, Stream, int[], Stream)

Inserts pages from an other file into the input Pdf file.

public bool TryInsert(Stream inputStream, int insertLocation, Stream portStream, int[] pageNumber, 
    Stream outputStream)
ParameterTypeDescription
inputStreamStreamInput Stream of Pdf file.
insertLocationInt32Insert position in input file.
portStreamStreamStream of Pdf file for pages.
pageNumberInt32[]The page number of the ported in portFile.
outputStreamStreamOutput Stream.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

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

Examples

PdfFileEditor pfe = new PdfFileEditor();
Stream sourceStream = new FileStream("file1.pdf", FileMode.Open, FileAccess.Read);
Stream insertedStream = new FileStream("file2.pdf", FileMode.Open, FileAccess.Read);
Stream outStream = new FileStream("out.pdf", FileMode.Create, FileAccess.Write);
bool result = pfe.TryInsert(sourceStream, 1, insertedStream, new int[] { 3, 4, 5}, outStream);

See Also