PdfFileEditor.TrySplitFromFirst

TrySplitFromFirst(string, int, string)

Splits Pdf file from first page to specified location,and saves the front part as a new file.

public bool TrySplitFromFirst(string inputFile, int location, string outputFile)
ParameterTypeDescription
inputFileStringSource Pdf file.
locationInt32The splitting point.
outputFileStringOutput Pdf file.

Return Value

True for success, or false.

Remarks

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

Examples

PdfFileEditor pfe = new PdfFileEditor();
bool result = pfe.TrySplitFromFirst("input.pdf", 5, "out.pdf");

See Also


TrySplitFromFirst(Stream, int, Stream)

Splits from start to specified location,and saves the front part in output Stream.

public bool TrySplitFromFirst(Stream inputStream, int location, Stream outputStream)
ParameterTypeDescription
inputStreamStreamSource Pdf file Stream.
locationInt32The splitting point.
outputStreamStreamOutput file Stream.

Return Value

True for success, or false.

Remarks

The streams are NOT closed after this operation. The TrySplitFromFirst method is like the SplitFromFirst method, except the TrySplitFromFirst 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 outStream = new FileStream("out.pdf", FileMode.Create, FileAccess.Write);
pfe.TrySplitFromFirst(sourceStream, 5, outStream);

See Also


TrySplitFromFirst(string, int, HttpResponse)

Splits document from first page to location and saves result into HttpResponse objects.

public bool TrySplitFromFirst(string inputFile, int location, HttpResponse response)
ParameterTypeDescription
inputFileStringSource file name.
locationInt32Split point.
responseHttpResponseHttpResponse objects.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

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

See Also


TrySplitFromFirst(Stream, int, HttpResponse)

Splits document from start to specified location and stores result into HttpResponse object.

public bool TrySplitFromFirst(Stream inputStream, int location, HttpResponse response)
ParameterTypeDescription
inputStreamStreamStream of source document.
locationInt32The splitting point.
responseHttpResponseHttpResponse object where result will be stored.

Return Value

true if operation completed successfully; otherwise, false.

Remarks

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

See Also