Convert PostScript using API for Java
This article explains how to convert PS files using Java on the example of PS to TIFF Conversion.
Aspose.Page lets you convert PS files using Java in high-quality BMP, JPG, TIFF, PNG, and PDF documents.
Java PS to TIFF Conversion
You can check the quality of Aspose.Page PS to TIFF conversion and view the results via our free online PostScipt to TIFF Converter or PostScript Viewer
Aspose.Page for Java PS converter allows to convert PostScript (PS) file on any OS for which Java Virtual Machine exists.
Take the next steps in order to perform PS to TIFF conversion:
- Create an instance of PsDocument from PostScript file.
- Use PdfSaveOptions(or ImageSaveOptions if you convert to an image format) to specify ImageFormat, Size, AdditionalFontsFolder and SuppressError values.
- Save the PostScript document as an image with image save options to an array of arrays of bytes. One array of bytes for one page of input document.
- Save resulting 2-dimensional arrays of bytes to TIFF files creating for every byte array a new file output stream.
- If SuppressErrors value was true, as it is by default, it is possible to see what errors were thrown during the conversion of EPS to TIFF and saved in Exceptions list.
Let’s consider ImageSaveOptions. Using this class we can assign different conversion parameters while converting PS to TIFF.
- Size specifies the resulting image width and height.
- ImageFormat specifies the output imagge format.
- SmoothingMode controls a quality of drawing curves, text and raster images in the resulting image.
- AdditionalFontsFolder specifies locations where to find fonts. System font folders are always included by default.
- SuppressError controls the behavior of EPS to BMP converter when non-critical errors are appeared. If the value is true then it is possible to view a list of such errors after conversion in the Exceptions field. The default value is true.
- Debug allows outputting debug information to the console. The default value is false.
Evaluate PS conversion online with our PS cross-platform Converter. You can convert several PS files instantly and dowload results in a few seconds.
You can download examples and data files from GitHub.