wubzz / pdf-merge

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

Unhandled error when trying to concat filenames with unicode #24

Closed LockedOnNone closed 6 years ago

LockedOnNone commented 6 years ago

Code used.

const PDFMerge = require('pdf-merge');

const files = [
    `íñdigó çu+ - 中文平が Cómpênsã_1.pdf`,
    `íñdigó çu+ - 中文平が Cómpênsã_2.pdf`,
];

//Save as new file
PDFMerge(files, {output: `3.pdf`})
.then((buffer) => {

});

Unhandled rejection Error: Command failed: pdftk "íñdigó çu+ - 中文平が Cómpênsã_1.pdf" "íñdigó çu+ - 中文平が Cómpênsã_2.pdf" cat output C:\Users\user\AppData\Local\Temp\tmp-185604IMduvgo3lhl Error: Unable to find file. Error: Failed to open PDF file: íñdigó çu+ - 中文平が Cómpênsã_1.pdf Error: Unable to find file. Error: Failed to open PDF file: íñdigó çu+ - 中文平が Cómpênsã_2.pdf Errors encountered. No output created. Done. Input errors, so no output created.

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:557:12)
wubzz commented 6 years ago

I'm not sure what part you consider the issue here: The unhandled exception - or that merging the files did not work due to unicode?

The unhandled exception would be because of missing .catch handler.

This lib makes no assumption of input being unicode or not, it simply passes it along to pdftk.

LockedOnNone commented 6 years ago

Yes, I forgot to indicate that the issue is the Unicode handling. I'll try and report this to pdftk, since it's a bug on their end. Thank you.