I am trying to convert PDF to image.
https://www.npmjs.com/package/pdf-poppler
const path = require('path');
const pdf = require('pdf-poppler');
let file = 'C:\\tmp\\convertme.pdf'
let opts = {
format: 'jpeg',
out_dir: path.dirname(file),
out_prefix: path.baseName(file, path.extname(file)),
page: null
}
pdf.convert(file, opts)
.then(res => {
console.log('Successfully converted');
})
.catch(error => {
console.error(error);
})
However the images generated doesn't have good quality. How I can specify the quality parameter.
Good question. You can use 'scale' to increase the size of the image, default is 1024.
let opts = {
format: 'jpeg',
out_dir: path.dirname(file)+'/images',
out_prefix: 'test_',
page: null,
scale: 4096
}