使用 PS 格式文件 | Aspose.Page 提供 C++

PSEPS 扩展分别与 Adob​​e 开发的 PostScript 和 Encapsulated PostScript 语言相关联。

PS 是一种动态页面描述语言。它使用图形运算符、过程、控制运算符和变量。 EPS 是一种受限的 PostScript 语言。某些 PostScript 运算符被禁止用于 EPS 文件。同时,EPS 文件必须符合 PostScript 文档结构约定规范,该规范要求使用结构注释。通常,EPS 格式用于描述可封装在 PostScript 文件及其派生文件中的单页图形。

Aspose.Page 库允许创建包含适当图形元素的 PS 或 EPS 文件,但在本指南中,我们将仅使用 PS 文件类型。 因此,我们使用以下代码创建 PS 文件:

 1{
 2    //Create output stream for PostScript document
 3    System::SharedPtr<System::IO::Stream> outPsStream = System::MakeObject<System::IO::FileStream>(dir + u"document.ps", System::IO::FileMode::Create);
 4
 5    //Create save options
 6    System::SharedPtr<PsSaveOptions> options = System::MakeObject<PsSaveOptions>();
 7            
 8    // Create new multipaged PS Document with one page opened
 9    System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(outPsStream, options, multiPaged);
10}

如果有人希望创建 EPS 文件,他们应该使用以下代码:

 1{
 2    //Create output stream for PostScript document
 3    System::SharedPtr<System::IO::Stream> outPsStream = System::MakeObject<System::IO::FileStream>(dir + u"document.eps", System::IO::FileMode::Create);
 4
 5    //Create save options
 6    System::SharedPtr<PsSaveOptions> options = System::MakeObject<PsSaveOptions>();
 7    //Set format of saved document as EPS
 8    options->set_SaveFormat(PsSaveFormat::EPS);
 9            
10    // Create new EPS Document
11    System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(outPsStream, options, false);
12}

请参阅在 Java 中使用 PS 文档。

Aspose.Page 库只能创建静态 PS/EPS 文档。不支持控制运算符。

目前,Aspose.Page 库只能创建 PostScript 文档,无法编辑。

本章包含有关使用 C++ 版 Aspose.Page API 解决方案处理 PS 文件的信息。您将在后续文章中找到该功能工作原理的代码示例。

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.