View Source PDF2Image (PDF2Image v0.1.0)

Summary

Functions

Convert a PDF file (on disk) to an image (in memory). Supported options

Types

@type option() ::
  {:device, term()}
  | {:resolution, pos_integer()}
  | {:page, pos_integer()}
  | {:fit_page, boolean()}
  | {:crop, boolean()}

Functions

Link to this function

convert(path, opts \\ [])

View Source
@spec convert(binary(), option()) :: {:ok, Vix.Vips.Image.t()} | {:error, term()}

Convert a PDF file (on disk) to an image (in memory). Supported options:

  • :device - The ghostscript device (aka output format) to use (default: pnggray) The default value is "pnggray".

  • :resolution (pos_integer/0) - The resolution of the output image in DPI (default: 150) The default value is 150.

  • :page (pos_integer/0) - The page number to convert (default: 1) The default value is 1.

  • :fit_page (boolean/0) - Fit the page size of the current device. Sets ghostscript option -dPDFFitPage. (default: true) The default value is true.

  • :crop (boolean/0) - Crop the output to the bounding box. Sets ghostscript option -dEPSCrop. (default: true) The default value is true.