原創|使用教程|編輯:郝浩|2013-03-13 15:50:51.000|閱讀 6434 次
概述:使用Aspose.Pdf的OutlineItemCollection,就可以在PDF文件中添加水印。首先需要使用Document對象打開PDF文件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
使用Aspose.Pdf的OutlineItemCollection,就可以在PDF文件中添加水印。首先需要使用Document對象打開PDF文件,之后就可以在Document對象的Outlines集合中添加OutlineItemCollection。不過要注意在添加OutlineItemCollection之前,需要先設置水印的屬性。
》》》下載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")
					本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:慧都控件網