yakovmeister / pdf2image

A utility for converting pdf to image and base64 format.
MIT License
435 stars 141 forks source link

ImageMagick 6.9 not supported? #202

Closed pjerryhu closed 2 months ago

pjerryhu commented 9 months ago

Hey folks, I'm trying to convert my pdf to images, and it seems setGMClass(true) is going to help me, however, it seems it only supports ImageMagick version >=7, since mine failed with version 6.9.

My code:

const pdf2picConvert = pdf2pic.fromBuffer(fileBuffer, {
    format: 'png',
    preserveAspectRatio: true,
    density: dpi // output pixels per inch
  })
  pdf2picConvert.setGMClass(true) // Use ImageMagick - this is the key line, so you don't have to touch return type

  const pageNumber = 1
  const imageBufferResponse = await pdf2picConvert(pageNumber, {
    responseType: 'buffer'
  })

Asking because I'm using vercel serverless api, and they only have ImageMagick 6.9 available in their image, they don't have graphicsmagick. Hence my struggle here

hereisabrams commented 2 months ago

Have you ever found something for this? having the same issue.

pjerryhu commented 2 months ago

Yea, I opted to use Docker Image + Render for deployment so I can use higher versioned ImageMagick. Not using Serverless API for this anymore