使用其他功能(如 通过 Java 打开受密码保护的 XPS 文档, 通过 Java 将 PCL 文档保存到数据库)将 XPS 保存为 PCL 的情况较少。
// open encrypted document
Document document = new Document("input.xps", "password");
// save XPS as a DOC
document.save("DocOutput.doc", SaveFormat.DOC);
public static void StoreToDatabase(Document doc, Connection mConnection) throws Exception {
// create an output stream which uses byte array to save data
ByteArrayOutputStream aout = new ByteArrayOutputStream();
// save the document to byte array
doc.save(aout, SaveFormat.PCL);
// get the byte array from output steam
// the byte array now contains the document
byte[] buffer = aout.toByteArray();
// get the filename from the document.
String fileName = doc.getOriginalFileName();
String filePath = fileName.replace("\\", "\\\\");
// create the SQL command.
String commandString = "INSERT INTO Documents (FileName, FileContent) VALUES('" + filePath + "', '" + buffer + "')";
Statement statement = mConnection.createStatement();
statement.executeUpdate(commandString);
}
使用 Java 开发 XPS 文件转换应用程序
需要开发基于 Java 的软件应用程序来轻松保存和导出 XPS 文件到 PCL 文档吗? 通过
Aspose.Total for Java
,任何Java开发人员都可以集成上述API代码来编写跨多种格式的转换应用程序,包括Microsoft Word(DOC、DOCX)、Excel(XLS、XLSX)、Powerpoint(PPT、PPTX)、PDF、电子邮件文件、图像(JPG、PNG、BMP、GIF)和其他格式。 强大的 Java 文档转换库,支持许多流行格式,包括 XPS 格式。 将文档导出和渲染为其他格式,程序员可以使用 Aspose.Total for Java 子 API,包括
Aspose.Words for Java
、
Aspose.Cells for Java
、
Aspose.Slides for Java
、
Aspose.PDF for Java
、
Aspose.Imaging for Java
等。
XPS Java 转换库
还有其他选项可以将 Aspose.Total for Java 集成到您的系统中。 请选择一个符合您需求的方案并按照分步说明进行操作:
- 直接从基于 Maven 的项目中使用 Aspose.Total for Java,并在 pom.xml 中包含相关子 API。
- 或者,可以从 下载 获取一个 ZIP 文件。
正在将 XPS 保存至 PCL 应用要求
任何可以运行 Java 运行时环境 (JRE) 的操作系统都可以运行 Aspose.Total for Java。 以下列出了大多数(但不是全部)受支持的操作系统。
- 微软 Windows
- Linux:Ubuntu、OpenSUSE、CentOS 等
- macOS :10.9 (Mavericks) 及更高版本
- 移动设备:Android、iOS
主要用途
在企业办公室进行高容量文件打印。
直接从 XPS 文件打印营销手册和技术手册。
保留法律或财务报告的精确页面布局。
用于批量文档输出的高效打印工作流程。
自动化场景
用于大规模打印作业的批量 XPS 到 PCL 转换。
与打印管理系统集成,实现自动化工作流程。
定期报告和文档打印的计划转换。
简化的企业文档处理流程。