Skip to content

PDF thumbnail converter

⚠️ avalable in v2.3.0

Variants images for thumbnail PDF are generates by poppler(pdftoppm and pdfinfo) installed on your system.

It is possible to specify the path of binaries. Useful if your installations are specific or if you are dropping off precompiled versions.

Installation required:

sh
sudo apt-get install poppler-data poppler-utils
sh
brew install poppler

Configuration

typescript
// config/attachment.ts //
const attachmentConfig = defineConfig({
  converters: {
    preview: { 
      converter: () => import('@jrmc/adonis-attachment/converters/pdf_thumbnail_converter'),
    }
  }
})

By default, image format is JPEG and size is video size. options attribute use image_converter

Sample:

typescript
const attachmentConfig = defineConfig({
  converters: {
    preview: { 
      converter: () => import('@jrmc/adonis-attachment/converters/pdf_thumbnail_converter'),
      format: 'webp',
      resize: 720
    }
  }
})