Working with PS Document | Java

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 in 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 for Java 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//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);

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

 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);

See working with PS documents in .NET and C++.

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 Java. There you will find the next articles with the code examples of how the functionality works.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.