• <menu id="w2i4a"></menu>
  • logo Aspose.PDF使用教程

    文檔首頁>>Aspose.PDF使用教程>>Aspose.Pdf使用教程:在現(xiàn)有的PDF文件中添加注釋

    Aspose.Pdf使用教程:在現(xiàn)有的PDF文件中添加注釋


    這個地方的所說的注釋包含在每個特定頁的注釋集中。因為每個PDF頁都有自己單獨的注釋集,所以這個注釋集也只是收錄這個PDF頁中的注釋。要在一個PDF頁中使用Aspose.Pdf添加注釋,必須要使用Add方法將這個需要添加的注釋添加到Annotations注釋集中。所以第一步是創(chuàng)建一個新的注釋,然后打開PDF文件,將之添加到該頁的注釋集中。

    》》》下載Aspose.Pdf試用版

    下面是具體的代碼示例:

    C#

    //open document
    Document pdfDocument = new Document("input.pdf");
    //create annotation
    TextAnnotation textAnnotation = new TextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600));
    textAnnotation.Title = "Sample Annotation Title";
    textAnnotation.Subject = "Sample Subject";
    textAnnotation.State = AnnotationState.Accepted;
    textAnnotation.Contents = "Sample contents for the annotation";
    textAnnotation.Open = true;
    textAnnotation.Icon = TextIcon.Key;
    Border border = new Border(textAnnotation);
    border.Width = 5;
    border.Dash = new Dash(1, 1);
    textAnnotation.Border = border;
    textAnnotation.Rect = new Aspose.Pdf.Rectangle(200, 400, 400, 600);
    //add annotation in the annotations collection of the page
    pdfDocument.Pages[1].Annotations.Add(textAnnotation);
    ////save output file
    pdfDocument.Save("output.pdf");
    
    

    VB.NET

    'open document
    Dim pdfDocument As New Document("input.pdf")
    'create annotation
    Dim textAnnotation As New TextAnnotation(pdfDocument.Pages(1), New Aspose.Pdf.Rectangle(200, 400, 400, 600))
    textAnnotation.Title = "Sample Annotation Title"
    textAnnotation.Subject = "Sample Subject"
    textAnnotation.State = AnnotationState.Accepted
    textAnnotation.Contents = "Sample contents for the annotation"
    textAnnotation.Open = True
    textAnnotation.Icon = TextIcon.Key
    Dim border As New Border(textAnnotation)
    border.Width = 5
    border.Dash = New Dash(1, 1)
    textAnnotation.Border = border
    textAnnotation.Rect = New Aspose.Pdf.Rectangle(200, 400, 400, 600)
    'add annotation in the annotations collection of the page
    pdfDocument.Pages(1).Annotations.Add(textAnnotation)
    '//save output file
    pdfDocument.Save("output.pdf")
    
    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();