原創(chuàng)|使用教程|編輯:郝浩|2013-03-13 15:50:51.000|閱讀 6421 次
概述:使用Aspose.Pdf的OutlineItemCollection,就可以在PDF文件中添加水印。首先需要使用Document對象打開PDF文件。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
使用Aspose.Pdf的OutlineItemCollection,就可以在PDF文件中添加水印。首先需要使用Document對象打開PDF文件,之后就可以在Document對象的Outlines集合中添加OutlineItemCollection。不過要注意在添加OutlineItemCollection之前,需要先設(shè)置水印的屬性。
》》》下載Aspose.Pdf試用版
下面的代碼片段演示了如何在PDF文件中添加水印。
C#
//open document Document pdfDocument = new Document("input.pdf"); //create a bookmark object OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines); pdfOutline.Title = "Test Outline"; pdfOutline.Italic = true; pdfOutline.Bold = true; //set the destination page number pdfOutline.Action = new Aspose.Pdf.InteractiveFeatures.GoToAction(doc.Pages[1]); //add bookmark in the document's outline collection. pdfDocument.Outlines.Add(pdfOutline); //save output pdfDocument.Save("output.pdf");
VB.NET
'open document Dim pdfDocument As New Document("input.pdf") 'create a bookmark object Dim pdfOutline As New OutlineItemCollection(pdfDocument.Outlines) pdfOutline.Title = "Test Outline" pdfOutline.Italic = True pdfOutline.Bold = True 'set the destination page number pdfOutline.Action = New Aspose.Pdf.InteractiveFeatures.GoToAction(doc.Pages(1)) 'add bookmark in the document's outline collection. pdfDocument.Outlines.Add(pdfOutline) 'save output pdfDocument.Save("output.pdf")
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)