PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDF Conversion SDK provides an API for converting PDF to images. Integrate ComPDF Conversion SDK to your apps to convert PDF into images easily.
In ComPDF Conversion SDK, supported image formats include:
Supported image color modes in ComPDF Conversion SDK include:
The SDK supports setting image scaling. The default scaling is 1.0, which maintains the original PDF page size. If you want to double the image size, you can set image_scaling to 2.0; similarly, to reduce the image size by half, set image_scaling to 0.5.
The SDK supports an option called image_path_enhance for enhancing the display of image paths. This option can be enabled when you want to enhance the display effect of paths within the PDF page.
Not enable image_path_enhance option(original PDF rendering effect):
Enable image_path_enhance option:
image_scaling value results in images with higher resolution, but it also increases memory usage and slows down the conversion.image_scaling value does not necessarily equate to higher clarity; the clarity also depends on the original image resolution in the document.The following complete example code demonstrates how to convert a PDF document into PNG format.
ConvertOptions opt;
// Convert PDF to Image (JPEG).
opt.image_type = ImageType::e_JPEG;
CPDFConversion::StartPDFToImage("jpeg.pdf", "password", "path/output", opt);
// Convert PDF to Image (PNG) and set image_scaling to double the original PDF size.
opt.image_type = ImageType::e_PNG;
opt.image_scaling = 2.0;
CPDFConversion::StartPDFToImage("png.pdf", "password", "path/output", opt);