Working with PS format files | C++

PS and EPS extensions are linked to the PostScript and Encapsulated PostScript languages respectively that Adobe developed.

PS is a dynamic Page description language. It uses graphics operators, procedures, control operators and variables. EPS is a restricted PostScript. Some PostScript operators are prohibited from using EPS files. At the same time, the EPS file must conform to PostScript Document Structuring Conventions Specifications that suppose to use structural comments. Generally, EPS was intended for the description of 1-paged graphics that can be encapsulated in PostScript files and their derivations.

Aspose.Page library allows the creation of both PS or EPS files with proper graphics elements, but in this guide, we will use only the PS file type. So we use for the creation of PS file such code:

 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}

If someone wish to create EPS file they should use the following code:

 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}

See working with PS documents in Java.

Aspose.Page library can create only static PS/EPS documents. Control operators are not supported.

At this moment Aspose.Page library can only create PostScript documents, not edit it.

This chapter includes information about working with PS files using Aspose.Page API solution for C++. There you will find the next articles with the code examples of how the functionality works.

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.