当前位置: 首页 > news >正文

Word控件Aspose.Words教程:操作 XPS 和 EPS 文档

Aspose.Words 是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。

Aspose API 支持流行文件格式处理,并允许将各类文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。

将 XPS 转换为 PDF

Aspose.Page 允许文档转换。例如,您可以将 XPS 转换为 PDF。让我们试试转换的例子。

重要须知

// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocumentConversion();
// Initialize PDF output stream
using (System.IO.Stream pdfStream = System.IO.File.Open(dataDir + "input.xps", System.IO.FileMode.Create, System.IO.FileAccess.Write))
// Initialize XPS input stream
using (System.IO.Stream xpsStream = System.IO.File.Open(dataDir + "XPStoPDF.pdf", System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
// Load XPS document form the stream
XpsDocument document = new XpsDocument(xpsStream, new XpsLoadOptions());
// or load XPS document directly from file. No xpsStream is needed then.
// XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions());// Initialize options object with necessary parameters.
Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions options = new Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions()
{
JpegQualityLevel = 100,
ImageCompression = Aspose.Page.XPS.Presentation.Pdf.PdfImageCompression.Jpeg,
TextCompression = Aspose.Page.XPS.Presentation.Pdf.PdfTextCompression.Flate,
PageNumbers = new int[] { 1, 2, 6 }
};// Create rendering device for PDF format
Aspose.Page.XPS.Presentation.Pdf.PdfDevice device = new Aspose.Page.XPS.Presentation.Pdf.PdfDevice(pdfStream);document.Save(device, options);
// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir();
// Initialize PDF output stream
FileOutputStream pdfStream = new FileOutputStream(dataDir + "XPStoPDF.pdf");// Load XPS document
XpsDocument document = new XpsDocument(dataDir + "input.xps");// Initialize options object with necessary parameters.
com.aspose.xps.rendering.PdfSaveOptions options = new com.aspose.xps.rendering.PdfSaveOptions();
options.setJpegQualityLevel(100);
options.setImageCompression(com.aspose.xps.rendering.PdfImageCompression.Jpeg);
options.setTextCompression(com.aspose.xps.rendering.PdfTextCompression.Flate);
options.setPageNumbers(new int[] { 1, 2, 6 });// Create rendering device for PDF format
com.aspose.xps.rendering.PdfDevice device = new com.aspose.xps.rendering.PdfDevice(pdfStream);document.save(device, options)

以上便是本篇文章的所有内容,要是您还有其他关于产品方面的问题,欢迎咨询我们

http://www.lryc.cn/news/68857.html

相关文章:

  • java并发-Exchanger
  • 毫米波雷达系列 | 传统CFAR检测(自适应类)
  • 【2023/05/19】NFA
  • 汽车功能安全
  • 【Python】数据分析与可视化实践:收支日统计数据可视化的实现
  • Halcon 中_xld算子的概念与应用? select_shape_std 和 select_shape_xld区别?
  • [pgrx开发postgresql数据库扩展]7.返回序列的函数编写(3)多行表序列
  • 刚入职,就想跑路了...
  • 如何让技术架构师具有预知未来业务发展的能力
  • 卷麻了,新来的00后实在是太卷了...
  • 单片机--实战练习
  • Go Etcd 分布式锁实战
  • Windows环境下pcl点云库 安装配置教程
  • 岗位分析与可视化系统(三)
  • unity进阶学习笔记:json和xml
  • 数据结构之初识树与堆
  • 虚拟化技术 — VirtIO 虚拟设备接口标准
  • Dubbo——SpringBoot集成Dubbo(@Autowired和@Reference的区别、Dubbo的服务治理)
  • 高并发系统的三把利器
  • AppiumWinAppDriver自动化测试 Failed to locate opened application window with appid问题
  • 渗透测试--6.1.aircrack-ng破解wifi密码
  • C++中的继承、以及赋值兼容转换。
  • js浏览器实现简单的实时扫一扫功能
  • unity愤怒的小鸟学习制作(二)
  • 干外包3年,彻底寄了...
  • 软考高项论文范文(三)
  • 浅谈谈谈OTA召回2023
  • 【GDI+】旋转文本/斜体字
  • python3 面试题总结
  • select poll epoll有什么区别