Convert PostScript with Aspose.Page 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 PostScipt to BMP Converter or PostScript Viewer

Aspose.Page for 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 PS to BMP conversion:

  1. Initialize an input stream for the input PS file.
  2. Create an instance of PsDocument from created earlier input stream.
  3. Use ImageSaveOptions(or PdfSaveOptions if you convert to PDF format) to specify AdditionalFontsFolder and SuppressError boolean value.
  4. Create an instance of ImageDevice(or PdfDevice if you convert to PDF format) specifying image type and size if it is necessary.
  5. 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.
  6. Save resulting 2-dimensional arrays of bytes to BMP files creating for every byte array a new file output stream.
  7. If the SuppressErrors value was true, as it is by default, It is possible to see what errors were thrown during the conversion of PS to BMP.

The following code snippet shows how to convert PS to BMP files in C++:

                
            

For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-C

See PS to BMP conversion in .Net and Java.

Let’s consider ImageSaveOptions. Using this class we can assign different conversion parameters while converting PS to BMP.

Have a look at PS online conversion in our PS cross-platform Converter. You can convert several PS files to BMP at once and download results in a few seconds.

Feel free download the examples and data files from GitHub.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.