原創|使用教程|編輯:郝浩|2013-03-29 11:03:38.000|閱讀 1442 次
概述:可以使用OutlineItemCollection在PDF文檔中添加書簽。 首先,你需要使用文檔對象打開PDF文檔。在那之后,你可以在文檔對象的Outlines集合中添加OutlineItemCollection。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
可以使用OutlineItemCollection在PDF文檔中添加書簽。 首先,你需要使用文檔對象打開PDF文檔。在那之后,你可以在文檔對象的Outlines集合中添加OutlineItemCollection。然而,在將OutlineItemCollection添加到Outlines集合之前,你需要定義書簽的屬性。
下面是在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@fc6vip.cn
文章轉載自:慧都控件網