Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty string output #84

Open
dontwork opened this issue Nov 19, 2020 · 7 comments
Open

Empty string output #84

dontwork opened this issue Nov 19, 2020 · 7 comments
Assignees

Comments

@dontwork
Copy link

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

@kuzdogan
Copy link

kuzdogan commented Jan 13, 2021

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

@kuzdogan
Copy link

kuzdogan commented Jan 13, 2021

Ok this is dumb but I actually didn't install the dependencies ghostscript and graphicsmagick 🤦. 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

@simaybocu
Copy link

Ok this is dumb but I actually didn't install the dependencies ghostscript and graphicsmagick 🤦. 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
2022-04-19 (6)
When I try to install the ghostscript4js package it gives this error. What could it be from? Can you please help?

@kuzdogan
Copy link

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
2022-04-19 (6)
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

@simaybocu
Copy link

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
2022-04-19 (6)
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?

@AndreasSauer
Copy link

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.
screenshot_cmd

@Suraj59
Copy link

Suraj59 commented Aug 4, 2022

is there any update regarding the issue? guys, it's working fine before now it's broken.

@github-project-automation github-project-automation bot moved this to To do in v4 Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

6 participants