pdf2image
pdf2image copied to clipboard
Empty string output
const options = {
density: 300, // ppi
format: "png",
width,
height
}
return pdf2pic.fromBuffer(buffer, options).bulk(1, true)
.then(resizedImageBase64 => {
Hi I use your library regularly, thank you for making it.
I recently had an issue where the resizedImageBase64
above was an empty string. I was actually unable to replicate the issue on either my windows machine or within WSL.... I have it running in docker with the imagemagick and ghostscript packages installed and this is where the error is occurring.
However some research showed that ghostscript might silently fail if a font is not included in the PDF and the PDF i had the issue did not have the font included that the text used. I was hoping it might be possible to pass options through to ghostscript through this library in order to test this hypothesis. Is this possible?
Thanks
I also have the same issue. Here's my code
let res = await fetch(url);
let buffer = await res.buffer();
const options = {
width: 2550,
height: 3300,
density: 330,
savePath: "./output/from-buffer-to-base64"
}
// let convert = fromPath('pdf.pdf', options);
let convert = fromBuffer(buffer, options);
console.log(convert)
let output = await convert(1, true)
console.log('output')
console.log(output)
let base64 = output.base64;
console.log('base64')
console.log(base64)
fetch
is the npm library node-fetch
here.
See the console outputs:
[Function: r] {
bulk: [Function],
setOptions: [Function],
setGMClass: [Function]
}
output
{ base64: '', size: '2550x3300', page: 1 }
base64
Edit: Does not work with the specimen1.pdf or other pdf's I tried
Ok this is dumb but I actually didn't install the dependencies ghostscript
and graphicsmagick
:facepalm:. Now it works. Just install it as here.
Unfortunately I won't be able to use the library since I'll use it in a Google Cloud Function. If you are looking for an alternative like me you can use external API's such as cloudconver
Ok this is dumb but I actually didn't install the dependencies
ghostscript
andgraphicsmagick
🤦. Now it works. Just install it as here.Unfortunately I won't be able to use the library since I'll use it in a Google Cloud Function. If you are looking for an alternative like me you can use external API's such as cloudconver When I try to install the ghostscript4js package it gives this error. What could it be from? Can you please help?
Ok this is dumb but I actually didn't install the dependencies
ghostscript
andgraphicsmagick
facepalm. Now it works. Just install it as here. Unfortunately I won't be able to use the library since I'll use it in a Google Cloud Function. If you are looking for an alternative like me you can use external API's such as cloudconver When I try to install the ghostscript4js package it gives this error. What could it be from? Can you please help?
I think I was referring to the Ubuntu packages: https://github.com/yakovmeister/pdf2image/blob/master/docs/gm-installation.md Follow the Windows instructions there
Ok this is dumb but I actually didn't install the dependencies
ghostscript
andgraphicsmagick
facepalm. Now it works. Just install it as here. Unfortunately I won't be able to use the library since I'll use it in a Google Cloud Function. If you are looking for an alternative like me you can use external API's such as cloudconver When I try to install the ghostscript4js package it gives this error. What could it be from? Can you please help?I think I was referring to the Ubuntu packages: https://github.com/yakovmeister/pdf2image/blob/master/docs/gm-installation.md Follow the Windows instructions there
yes, I installed both under C:\Program Files, but it still doesn't work, base64 is an empty string :(( Do you know a different package with a similar function?
Unfortunately, I also only get an empty string back. Am I doing something wrong? I have installed ghostscript and graphicsmagick. Is there anything else I should be aware of? I am currently using Windows 10.
is there any update regarding the issue? guys, it's working fine before now it's broken.