This brief tutorial describes how to convert PDF to image in C++. You can load the PDF file from the disk into the Document class object and configure the output SVG image properties as well. Once the save options are defined in C++ PDF to image conversion can be simply performed by calling the save function of the document class.
Steps to Convert PDF to Image in C++
- Add the reference to Aspose.Pdf for C++ library from the NuGet package manager for PDF to Image conversion
- Add a reference to the required namespaces with the help of using namespace directive
- Load the source PDF file into the Document class object from the disk
- Create SvgSaveOptions class object to configure the output image file
- Save the output file as an SVG image file
For converting PDF to image C++ language-based requirements are described in these steps. You have to add the required package and necessary namespaces at the beginning of the application. The process is quite simple where first you load the source PDF and then save it as an SVG image with the default configuration.
Code to Convert PDF to Image in C++
This code uses MakeObject() which creates a Document object on the heap and returns a shared pointer to the loaded PDF file. Similarly, we use MakeObject() to create the SvgSaveOptions class object to configure the output SVG image properties. In the final step, the Document->Save() function is used to save the PDF file as an image.
This quick tutorial has explained how using C++ convert PDF to image. If you want to convert PDF to some other format say HTML, refer to the article on how to convert PDF to HTML using C++.