Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Convert PDF to Image

Overview

ComPDF Conversion SDK provides an API for converting PDFs to images.

Supported image formats include JPG, JPEG, JPEG2000, PNG, BMP, TIFF, TGA, GIF, and WEBP.

Sample

js
const ImageType = {
  JPG: 0,
  JPEG: 1,
  JPEG2000: 2,
  PNG: 3,
  BMP: 4,
  TIFF: 5,
  TGA: 6,
  GIF: 7,
  WEBP: 8
};

const options = {
  imageType: ImageType.PNG,
  imageColorMode: 0,
  imageScaling: 1.0
};

const result = sdk.startPDFToImage(
  inputFilePath,
  "",
  outputDirectory,
  options
);