Overview
ComPDF Conversion SDK provides an API for converting PDF to images.
Setting Image Formats
Supported image formats include:
- JPG
- JPEG
- JPEG2000
- PNG
- BMP
- TIFF
- TGA
- GIF
- WEBP
Setting Image Color Modes
Supported image color modes include:
e_CColor: Color mode, where the image effect is consistent with the original PDF page.e_CGray: Grayscale mode.e_CBinary: Black and white mode.
Setting Image Scaling
The SDK supports setting image scaling. If you want to double the image size, set image_scaling to 2.0f; to reduce the image size by half, set image_scaling to 0.5f.
Enhancing Image Path Display
The SDK supports image_path_enhance for enhancing the display of image paths. This option can be enabled when you want to improve the display effect of paths within the PDF page.
- Disable
image_path_enhanceoption:
- Enable
image_path_enhanceoption:
Notice
- A higher
image_scalingvalue results in images with higher resolution, but it also increases memory usage and slows down conversion. - A higher
image_scalingvalue does not necessarily mean higher clarity. The clarity also depends on the original image resolution in the document.
Sample
c
CConvertOption option = CPDF_DefaultConvertOption();
option.image_type = e_CJPEG;
CPDF_StartPDFToImage(CPDF_TEXT("jpeg.pdf"), CPDF_TEXT("password"), CPDF_TEXT("path/output"), option, NULL);
option.image_type = e_CPNG;
option.image_scaling = 2.0f;
CPDF_StartPDFToImage(CPDF_TEXT("png.pdf"), CPDF_TEXT("password"), CPDF_TEXT("path/output"), option, NULL);