使用 PS 文档 | Aspose.Page 提供 Java
PS
和 EPS
扩展分别与 Adobe 开发的 PostScript 和 Encapsulated PostScript 语言相关。
PS 是一种动态页面描述语言。它使用图形操作符、过程、控制操作符和变量。 EPS 是一种受限的 PostScript 语言。某些 PostScript 操作符禁止在 EPS 文件中使用。同时,EPS 文件必须符合 PostScript 文档结构约定规范,该规范要求使用结构注释。通常,EPS 格式用于描述可封装在 PostScript 文件及其派生类中的单页图形。
Aspose.Page for Java 库允许创建包含适当图形元素的 PS 或 EPS 文件,但在本指南中,我们将仅使用 PS 文件类型。 因此,我们使用以下代码创建 PS 文件:
1//Create save options
2PsSaveOptions options = new PsSaveOptions();
3
4//Create output stream for PS document
5FileOutputStream outPsStream = new FileOutputStream(dataDir + "document.ps");
6
7//Create PS document
8PsDocument document = new PsDocument(outPsStream, options, false);
如果有人希望创建 EPS 文件,他们应该使用以下代码:
1//Create save options
2PsSaveOptions options = new PsSaveOptions();
3//Set save format as EPS
4options.setSaveFormat(PsSaveFormat.EPS);
5
6//Create output stream for EPS document
7FileOutputStream outPsStream = new FileOutputStream(dataDir + "document.eps");
8
9//Create EPS document
10PsDocument document = new PsDocument(outPsStream, options, false);
请参阅在 .NET 中使用 PS 文档。
Aspose.Page 库只能创建静态 PS/EPS 文档。不支持控制运算符。
目前,Aspose.Page 库只能创建 PostScript 文档,无法编辑。
本章包含有关使用 Java 版 Aspose.Page API 解决方案处理 PS 文件的信息。您将在后续文章中找到该功能工作原理的代码示例。