PDF thumbnail converter
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-popplersh
pnpm install node-popplersh
yarn add node-popplerConfiguration
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'),
options: {
format: 'webp',
resize: 720
}
}
}
})