default image background color
it would be great it we could set default background color through options
Since this module uses ImageMagick for pdf to image conversion, you can check ImageMagick's available options for such custom behavior http://www.imagemagick.org/script/command-line-options.php
You can set ImageMagick's options as follows:
var pdfImage = new PDFImage("/tmp/slide.pdf");
pdfImage.setConvertOptions({
"-density": 300,
"-trim": null
});
P.S.
I tried some options to set background color, but failed to get preferred result. Maybe, it's not effective to PDF's.
It seems that pdfImage doesn't have setConvertOptions.
I found workaround for bg color:
gm(imagePath).resize(width).extent(width, height + 0.1).
I'm also having difficulties with the setConvertOptions.
I tried adding an options array to the constructor:
var image = new PDFImage(path, options);
and adding some options using the setConvertOptions:
pdfImage.setConvertOptions({
'-density': '300',
'-depth': '8'
});
Both options don't work. Is it possible that you have to update the npm package?
It works fine when I do:
var pdfImage = new PDFImage(path, {
convertOptions: {
'-density': '300',
'-depth': '8',
'-background': 'white',
'-flatten': ''
}
});