Convert PostScript with Aspose.Page JavaScript via C++ API
This article explains how to convert PS files using C++ on the example of PS to BMP Conversion.
Aspose.Page lets you convert PS files using Java in high-quality BMP, JPG, TIFF, PNG, and PDF documents.
You can check the quality of Aspose.Page PS to BMP conversion and view the results via free online PostScript to BMP Converter or PostScript Viewer
Aspose.Page for JavaScript via C++ PS to BMP converter allows to convert PostScript (PS) file to BMP image on Windows and Linux.
It is necessary to take several steps for the PS to BMP conversion:
- Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’.
- On load event handler call AsposePSSaveAsImage and pass the file content and its name, image format Module.ImageFormat.Bmp and SuppressError boolean values to it.
- The result JSON contains the count of files in countFiles and the array of file names in filesNameResult. One file for one page of the input document.
- If the SuppressErrors value was true, as it is by default, it is possible to see what errors were thrown during the conversion of EPS to PNG.
- You can download files by using the DownloadFile function: ‘for (let fileIndex = 0; fileIndex < JSON.filesCount; fileIndex++) DownloadFile(JSON.filesNameResult[fileIndex], “image/png”);’
The following code snippet shows how to convert PS to BMP files in JavaScript:
For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-JavaScript-C
Let’s consider some parameters.
- SuppressError controls the behavior of PS to image converter when non-critical errors appear. 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.
Have a look at the PS online conversion in our PS cross-platform Converter. You can convert several PS files to BMP at once and download the results in a few seconds.
Feel free to download the examples and data files from GitHub.