TryAppend

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

追加页面,这些页面是从 portStreams 中的文档数组中选择的。 结果文档包括 firstInputFile 和 startPage 到 endPage 范围内的所有 portStreams 文档页面。

public bool TryAppend(Stream inputStream, Stream[] portStreams, int startPage, int endPage, 
    Stream outputStream)
范围类型描述
inputStreamStream输入 PDF 流。
portStreamsStream[]要从中复制页面的文档。
startPageInt32页面从 portStreams 文档开始。
endPageInt32页面以 portStreams 文件结尾。
outputStreamStream输出 PDF 流。

返回值

真为成功,或为假。

评论

TryAppend 方法与 Append 方法类似,只是 TryAppend 方法在操作失败时不会抛出异常。

例子

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);

也可以看看


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

附加页面,这些页面是从 portFiles 文档中选择的。 结果文档包括 firstInputFile 和所有 portFiles 文档页面在 startPage 到 endPage 范围内。

public bool TryAppend(string inputFile, string[] portFiles, int startPage, int endPage, 
    string outputFile)
范围类型描述
inputFileString输入PDF文件。
portFilesString[]要从中复制页面的文档。
startPageInt32页面从 portFiles 文档开始。
endPageInt32页面以 portFiles 文件结尾。
outputFileString输出 PDF 文档。

返回值

如果操作成功完成,则为 true;否则为假。

评论

TryAppend 方法与 Append 方法类似,只是 TryAppend 方法在操作失败时不会抛出异常。

例子

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

也可以看看


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

将文档附加到源文档并将结果保存到响应对象中。

public bool TryAppend(Stream inputStream, Stream[] portStreams, int startPage, int endPage, 
    HttpResponse response)
范围类型描述
inputStreamStream包含源文档的流。
portStreamsStream[]带有要附加的文档的流数组。
startPageInt32附加页的起始页。
endPageInt32附加页的结束页。
responseHttpResponse将保存文档的响应对象。

返回值

如果操作成功完成,则为 true;否则为假。

评论

TryAppend 方法与 Append 方法类似,只是 TryAppend 方法在操作失败时不会抛出异常。

也可以看看


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

将文档附加到源文档并将结果保存到 HttpResponse 对象中。

public bool TryAppend(string inputFile, string[] portFiles, int startPage, int endPage, 
    HttpResponse response)
范围类型描述
inputFileString包含源文档的文件名。
portFilesString[]包含附加文档的文件名数组。
startPageInt32附加页的起始页。
endPageInt32附加页的结束页。
responseHttpResponse将保存文档的响应对象。

返回值

如果操作成功完成,则为 true;否则为假。

评论

TryAppend 方法与 Append 方法类似,只是 TryAppend 方法在操作失败时不会抛出异常。

也可以看看