原創(chuàng)|使用教程|編輯:郝浩|2013-03-22 09:51:49.000|閱讀 873 次
概述:要在一個PDF文檔中添加附件,您需要創(chuàng)建一個要添加的FileSpecification對象和文件的描述。之后就可以使用集合的Add方法將之添加到Document對象的EmbeddedFiles集合中。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
要在一個PDF文檔中添加附件,您需要創(chuàng)建一個要添加的FileSpecification對象和文件的描述。之后就可以使用集合的Add方法將之添加到Document對象的EmbeddedFiles集合中。 這個EmbeddedFiles集合包含添加到PDF文件中的所有附件。
下面的代碼片段演示了如何在PDF文件中添加附件:
C#
//open document Document pdfDocument = new Document("input.pdf"); //setup new file to be added as attachment FileSpecification fileSpecification = new FileSpecification("test.txt", "Sample text file"); //add attachment to document's attachment collection pdfDocument.EmbeddedFiles.Add(fileSpecification); //save new output pdfDocument.Save("output.pdf");
VB.NET
'open document Dim pdfDocument As New Document("input.pdf") 'setup new file to be added as attachment Dim fileSpecification As New FileSpecification("test.txt", "Sample text file") 'add attachment to document's attachment collection pdfDocument.EmbeddedFiles.Add(fileSpecification) 'save new output pdfDocument.Save("output.pdf")
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)