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

No errors but no image written #6

Open
thokkane opened this issue Oct 2, 2019 · 2 comments
Open

No errors but no image written #6

thokkane opened this issue Oct 2, 2019 · 2 comments

Comments

@thokkane
Copy link

thokkane commented Oct 2, 2019

Can't get an image generated from the pdf. No errors either. Any ideas?

const tempDir = os.tmpdir()
await new Promise(function (resolve, reject) {
  gs()
    .batch()
    .nopause()
    .executablePath('lambda-ghostscript/bin/./gs')
    .option('-dTextAlphaBits=4')
    .res(300)
    .device('jpg')
    .output(`${tempDir}/page-01.jpg`)
    .input(filepath)
    .exec(function (err, stdout, stderr) {
        if (!err) {
          console.log('gs executed w/o error');            
          console.log('stdout',stdout);            
          console.log('stderr',stderr);            
          resolve();
        } else {
          console.log('gs error:', err);
          reject(err);
        }
    });
});
fs.lstat(tempDir+'/page-01.jpg', (err, stats) => {
  if(err)
      return console.log(err); //Handle error
  console.log(`Is file: ${stats.isFile()}`);
});
gs command: -dBATCH,-dNOPAUSE,-dTextAlphaBits=4,-r300,-sDEVICE=jpg,-sOutputFile=/var/folders/dd/zdnq1dcn2vb328ntxxt7_97c0000gn/T/page-01.jpg,/var/folders/dd/zdnq1dcn2vb328ntxxt7_97c0000gn/T/m5YF7ipQsLCuTE9c0pWC_raw.pdf
info: gs executed w/o error
info: stdout 
stderr undefined
info: { Error: ENOENT: no such file or directory, lstat '/var/folders/dd/zdnq1dcn2vb328ntxxt7_97c0000gn/T/page-01.jpg'
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/var/folders/dd/zdnq1dcn2vb328ntxxt7_97c0000gn/T/page-01.jpg' }```
@thokkane
Copy link
Author

thokkane commented Oct 8, 2019

@ultrasaurus any ideas?

@jelizarovas
Copy link

  1. make sure you have pulled in the git submodule with git submodule update --init
  2. try to see if you can use linux system, some users reported to get error on Windows devices
  3. make sure you have required permissions on the lambda-ghostscript module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants