Skip to content

PDF thumbnail converter

⚠️ avalable in v2.3.0

Variants images for thumbnail PDF are generates by node-poppler. Make sure you have poppler(pdftocairo) 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
npm install node-poppler
sh
pnpm install node-poppler
sh
yarn add node-poppler

Configuration

typescript
// config/attachment.ts
export default defineConfig({
  converters: [
    { 
      key: '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
export default defineConfig({
  converters: [
    { 
      key: 'preview',
      converter: () => import('@jrmc/adonis-attachment/converters/pdf_thumbnail_converter'),
      options: {
        format: 'webp',
        resize: 720
      }
    }
  ]
})