TJkrusinski / NodePDF

Down and dirty PDF rendering in Node.js with PhantomJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'redirection unexpected'

neoborn opened this issue · comments

Hi,

I encountered this error while using this module in Ubuntu server (14.04 LTS)

pdfgenerator stderr /bin/sh: 1: 
pdfgenerator stderr Syntax error: redirection unexpected
pdfgenerator stderr 
error in pdfgenerator: PDF conversion failed with exit of 2

From my research, it's could be because of Ubuntu's default shell, which is Dash (/bin/sh) and it should be /bin/bash shell. *http://stackoverflow.com/questions/2462317/bash-syntax-error-redirection-unexpected

Additionally, the /etc/passwd file shows that the account that I used to run the code has /bin/bash as its default shell.

any idea on this matter?

Here is my code:

            var html = ejs.render(templateString, <object_to_render>);

            var filename = 'application-'+app._id + '.pdf';
            var filepath = config.generatedDir + '/' + filename;

            var pdf = new NodePDF(null, filepath, {
                'content': html,
                'args': '--debug=true',
                'paperSize': {
                    'pageFormat': 'A4',
                    'footer': {
                        'height': '0.7cm',
                        'contents': '<p style="text-align:center">{currentPage} / {pages}</p>'
                    }
                },
                'zoomFactor': 1.1
            });

            pdf.on('error', function(msg){
                console.log('error in pdfgenerator:', msg);
            });

            pdf.on('done', function(filePath){
                console.log(filePath);
                if (filePath) {
                    //save file information to database
                }
            });

            pdf.on('stdout', function(stdout){
                console.log('pdfgenerator stdout', stdout);
            });


            pdf.on('stderr', function(stderr){
                console.log('pdfgenerator stderr', stderr);
            });

appreciate any help.
thank you.