logo Aspose.PDF使用教程 我也要发布文档

为PDF文件添加swf注释


Aspose.Pdf可以为PDF文件添加各种形式的注释,包括将swf文件作为注释添加进PDF文件中,这一操作可以通过简单的代码片段实现。

》》》下载Aspose.Pdf试用版

下面是代码示例:

C#

//Open the PDF document
Document doc = new Document("d:/pdftest/input.pdf");
// get reference of the page to which you need to add the annotation
Page page = doc.Pages[1];
// create ScreenAnnotation object with .swf multimedia file as an argument
ScreenAnnotation annotation = 
   new ScreenAnnotation(page, new Aspose.Pdf.Rectangle(0, 400, 600, 700),
   @"E:\First_Application_with_Aspose.Pdf_for_.NET.swf");
// add the annotation to annotations collection of page
page.Annotations.Add(annotation);
// save the update PDF document with annotation
doc.Save("d:/pdftest/Pdf_Filesample_with_SWF.pdf");

VB.NET

'Open the PDF document
Dim doc As Document = New Document("d:/pdftest/input.pdf")
' get reference of the page to which you need to add the annotation
Dim page As Page = doc.Pages(1)
' create ScreenAnnotation object with .swf multimedia file as an argument
Dim annotation As ScreenAnnotation = 
    New ScreenAnnotation(page, New Aspose.Pdf.Rectangle(0, 400, 600, 700), 
   "E:\First_Application_with_Aspose.Pdf_for_.NET.swf")
' add the annotation to annotations collection of page
page.Annotations.Add(annotation)
' save the update PDF document with annotation
doc.Save("d:/pdftest/Pdf_Filesample_with_SWF.pdf")