writePageBitmap2
Write a page to an image file.
writePageBitmap2([in] int page, [in] double hDPI, [in] double vDPI, [in] int color,
[in] int format, [in] BSTR fileName)
This function converts a PDF page to an image file on disk. It is
identical to
writePageBitmap
, except that it allows the horizontal
and vertical resolutions to be controlled independently.
The arguments are:
page
= page numberdpi
= resolution (dots per inch)color
= color setting - one of:imageMono
: 1-bit monochromeimageGray
: 8-bit grayscaleimageRGB
: 8-bit RGBimageCMYK
: 8-bit CMYKimageDevNToCMYK
: 8-bit CMYK, rasterized in DeviceN and then converted to CMYKimageDevNToRGB
: 8-bit RGB, rasterized in DeviceN and then converted to RGBimageGrayToMono
: 1-bit monochrome, rasterized in 8-bit grayscale and then converted to 1-bit
format
= image file format - one of:imageFileBMP
: Windows BMP format
(available for mono, gray, RGB, DevNToRGB, GrayToMono)imageFileTIFF
: uncompressed TIFF format
(available for mono, gray, RGB, CMYK, DevNToCMYK, DevNToRGB, GrayToMono)imageFileJPEG
: JPEG format
(available for gray, RGB, CMYK, DevNToCMYK, DevNToRGB)imageFilePNG
: PNG format
(available for mono, gray, RGB, DevNToRGB, GrayToMono)imageFilePNM
: PBM (monochrome), PGM (grayscale), or PPM (RGB) file - these formats are more commonly used on Unix
(available for mono, gray, RGB, DevNToRGB, GrayToMono)
fileName
= image file name
pdf.imageMono
, pdf.imageFileBMP
, etc.
The imageDevNToCMYK
mode produces CMYK output like imageCMYK
,
but does the rasterization in DeviceN (CMYK + spot colors) so
overprint previews will be more accurate.
The imageDevNToRGB
mode is similar to imageDevNToCMYK
, but
converts to RGB output.
The imageGrayToMono
mode does the rasterization in 8-bit grayscale
and converts to 1-bit monochrome at the end. This is useful for files
that use transparency – because 1-bit monochrome mode doesn't
support transparency.
CMYK output is only available in TIFF format.
VB:
' convert page 5 to a 144x72 dpi color TIFF file
pdf.writePageBitmap2 5, 72, pdf.imageRGB, pdf.imageFileTIFF, "test1.tiff"