wubzz / pdf-merge

Merge multiple PDF Files into a single PDF document
127 stars 32 forks source link

Example #9

Closed prescottprue closed 7 years ago

prescottprue commented 8 years ago

It would be really nice to have a working example that can be run. I am not able to get any successful output from the library at all.

Docs aren't super clear on if you are supposed to provide file streams or file paths (found out it was paths by getting an error when trying to pass a readStream).

Tried tons of combinations including:

 new PDFMerge([__dirname + '/test.pdf'])
    .merge(function(err, res){
       console.log('res:', err, res)
    })

then

 new PDFMerge([__dirname + '/test.pdf'])
    .asNewFile(__dirname + '/merged.pdf')
    .merge(function(err, res){
       console.log('res:', err, res)
    })

and another

new PDFMerge([__dirname + '/test.pdf'])
    .asNewFile(__dirname + '/merged.pdf')
    .promise()
    .then(function(res) { console.log('res:', res) })
    .catch(function(err) { console.log('error:', err) })
wubzz commented 8 years ago

@prescottprue Added example to docs.

Are you running this on Windows or Linux? Should always get either an error or a success. Either one would be interesting in the context of this issue.

prescottprue commented 8 years ago

@wubzz Thanks for the example! I am using Mac (i.e. Linux), and was seeing absolutely nothing.

Ill try out the example and go from there, it could be something small I am missing.

vbeffa commented 7 years ago

I had the same issue on Mac OS Sierra - hanging with no output. Turned out to be a problem with the pdftk server. See this link: http://stackoverflow.com/questions/39750883/pdftk-hanging-on-macos-sierra. Solved the issue for me.