热门版块
话题:285关注:0
话题:178关注:0
话题:166关注:0
话题:132关注:0
话题:124关注:0
话题:120关注:0
原创|使用教程|编辑:郝浩|2013-03-11 13:06:51.000|阅读 1098 次
概述:要在一个PDF页中使用Aspose.Pdf添加注释,必须要使用Add方法将这个需要添加的注释添加到Annotations注释集中。
相关链接:
这个地方的所说的注释包含在每个特定页的注释集中。因为每个PDF页都有自己单独的注释集,所以这个注释集也只是收录这个PDF页中的注释。要在一个PDF页中使用Aspose.Pdf添加注释,必须要使用Add方法将这个需要添加的注释添加到Annotations注释集中。所以第一步是创建一个新的注释,然后打开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")
好文不易,鼓励一下吧!
本系列教程将为您带来LightningChart.NET中文用户手册,本篇将为您介绍手动配置Visual Studio。
在“Outline”视图或“Mind Map”视图中能展开和折叠单个或所有想法。而在Normal视图中,工具栏上的展开与折叠和“View”菜单上的“Collapse All”、“Expand All”命令工作方式相同。
Outline视图提供了一种清晰、有调理的方式来查看思想,可以让使用者快速、容易地了解思想网络的活动区域。在保持有序视图的同时,详细程度可以达到您想要的深度。
PDF文档操作API哪家强?一张表带你了解Aspose和Spire系列PDF控件全功能对比
2019-11-13使用Aspose.PDF for .NET将PDF转换为HTML格式示例解读(7)——添加前缀以导入指令
2019-11-14超77%财富企业推荐!文档操作控件Aspose&Spire系列最新中文教程来啦!
2019-11-14使用Aspose.PDF for .NET将PDF转换为HTML格式示例解读(8)——将输出保存到Stream对象
2019-11-19PDF管理控件Aspose.PDF for .Net使用教程(二十):修剪页面周围的空白
2019-11-20使用Aspose.PDF for .NET将PDF转换为HTML格式示例解读(9)——获取转换进度详细信息
2019-11-21微信扫码登录
福利更多、资源更多
官方微信
官方微博
慧都科技有限公司 版权所有 Copyright 2003-2019 渝ICP备12000582号 渝公网安备 50010702500608号