In this tutorial, we will understand how to convert PUB) to PNG using C++. You will notice that the conversion takes place in two steps. Firstly, the PUB file is converted to a PDF file and then the intermediate PDF file is rendered to PNG format using C++ with simple API calls.
Steps to Convert PUB to PNG using C++
- Install Aspose.PUB for C++ and Aspose.PDF for C++ from NuGet package Manager Tool
- Add reference to Aspose::Pub and Aspose::Pdf namespaces
- Load the input PUB file with Document class instance
- Create the intermediate PDF file with ConvertToPdf method
- Iterate each page and create the output PNG images
You can efficiently export PUB to PNG using C++ with simple API calls in few lines of code. You only need to specify the file paths and make the method calls then the API considers all minor details of the conversion process by itself. After processing, the output PNG images are saved as per your requirements.
Code to Convert PUB to PNG using C++
In previous topic, we learned how to read PDF File in C++. Whereas, in this article we have discussed how using C++ create PNG from PUB file.