- 使用C#或VB.NET将注释从XFDF导入到PDF
- 使用C#或VB.NET将注释从PDF导出到XFDF
(安装包仅提供部分功能,并设置限制,如需试用完整功能请申请免费授权。)
17周年庆来啦!整合所有格式API处理控件Aspose.Total永久授权火热促销中,新购乐享85折起!联系客服立马1分钟了解全部!
使用C#或VB.NET将注释从XFDF导入到PDF
可以使用C#或VB.NET编程语言从基于.NET的应用程序中的现有XFDF文件将注释导入PDF文件。API支持导入API参考中AnnotationType枚举下列出的不同类型的注释。让我们按照以下步骤在基于.NET Framework的应用程序中使用C#或VB.NET编程语言将注释从XFDF导入PDF。
- 初始化PdfAnnotationEditor类对象
- 加载输入的PDF文档
- 加载XFDF文件以导入注释
- 指定要导入的注释类型
- 将注释从XFDF导入到PDF文件
- 保存输出的PDF文件
下面的代码段显示了如何使用C#或VB.NET将注释从XFDF文件导入PDF文件:
// Create an object of PdfAnnotationEditor classPdfAnnotationEditor editor = new PdfAnnotationEditor();// Bind input PDF fileeditor.BindPdf(dataDir + "inFile.pdf");// Create a file stream for input XFDF file to import annotationsFileStream fileStream = new FileStream(dataDir + "exportannotations.xfdf", FileMode.Open, FileAccess.Read);// Create an enumeration of all the annotation types which you want to importEnum[] annType = { AnnotationType.Text };// Import annotations of specified type(s) from XFDF fileeditor.ImportAnnotationFromXfdf(fileStream, annType);// Save output pdf fileeditor.Save(dataDir + "ImportAnnotations_out.pdf");
使用C#或VB.NET将注释从PDF导出到XFDF文件
- 初始化PdfAnnotationEditor对象
- 加载输入PDF文件
- 创建XFDF文件以保存导出的注释
- 指定注释类型以导出
- 使用ExportAnnotationsXfdf方法导出注释
下面的代码段显示了如何使用C#或VB.NET将注释从PDF文件导出到XFDF文件:
// Create an object of PdfAnnotationEditor classPdfAnnotationEditor editor = new PdfAnnotationEditor();// Bind input PDF fileeditor.BindPdf(dataDir + "inFile.pdf");// Create a file stream for output XFDF file to export annotationsFileStream fileStream = new FileStream(dataDir + "exportannotations.xfdf", FileMode.Create, FileAccess.Write);// Create an enumeration of all the annotation types which you want to exportEnum[] annoType = { AnnotationType.Text };// Export annotations of specified type(s) to XFDF fileeditor.ExportAnnotationsXfdf(fileStream, 1, 5, annoType);
还想要更多吗可以点击阅读【2020 · Aspose最新资源整合】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!