Output image formats for rasterized PDF

Q: Could you please provide a brief description of the image formats that PDFTron SDK extracts and the pixel size. I cannot find much detail on the website.


This info is included in API Ref for PDFDraw class:


The file format of the output image. Currently supported formats are:

• “RAW” : RAW format. There are four possibilities: e_rgba - if transparent and color page; e_gray_alpha - if transparent and gray page; e_rgb - if opaque and color page; e_gray - if opaque and gray page.

• “BMP” : Bitmap image format (BMP)

• “JPEG” : Joint Photographic Experts Group (JPEG) image format

• “PNG” : 24-bit W3C Portable Network Graphics (PNG) image format

• “PNG8” : 8-bit, palettized PNG format. The exported file size should be smaller than the one generated using “PNG”, possibly at the expense of some image quality.

• “TIFF” : Tag Image File Format (TIFF) image format.

• “TIFF8” : Tag Image File Format (TIFF) image format (with 8-bit palete).

For for info please info for ‘encoder_params’.

There is also PDFDraw::GetBitmap() which can be used to rasterize PDF to a memory bitmap that can be compressed and serialized using in any format using third party image libs.