wubzz / pdf-merge

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

unable to find file error when working with full path of pdftk #33

Closed samirame closed 4 years ago

samirame commented 5 years ago

Hi, I am trying to merge two pdf files using this module. the pdftk path is provided via libPath option (the pdftk path is not added to system path intentianally) and I am testing it on a windows 10. The pdf files are existing and I could successfully call pdftk from terminal to merge the files.

Below is the error I get when I call the nodejs app:

Error: Command failed: C:\Program Files (x86)\PDFtk Server\bin\pdftk "\\path\to\file\pdf1.pdf" "\\path\to\file\pdf2.pdf" cat output C:\Users\xxx\AppData\Local\Temp\tmp-14904mfi8iz708E7J Error: Unable to find file. Error: Failed to open PDF file: "\\path\to\file\pdf1.pdf" Error: Unable to find file. Error: Failed to open PDF file: "\\path\to\file\pdf2.pdf" Errors encountered. No output created. Done. Input errors, so no output created. at ChildProcess.exithandler (child_process.js:294:12) at ChildProcess.emit (events.js:189:13) at maybeClose (internal/child_process.js:970:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) ...

Any help would be appreciated!

wubzz commented 5 years ago

Are you trying to use relative path for the files or absolute path?

The docs specify you need to input the full path. For example:

C:\Dev\pdf1.pdf C:\Dev\pdf2.pdf

Not

\pdf1.pdf \pdf2.pdf

samirame commented 5 years ago

Hi! thanks for the prompt response.

The pdf files are located on a shared server, and yes they are full pathes of the files. e.g. \\myserver.com\path\to\pdf\pdf1.pdf

Anonymizing file paths might have been misleading. My appologies. (Hmmm and also not putting the error log into code section manipulated two backslashes as one! I have updated my first comment accordingly, using code section for the error log)

wubzz commented 5 years ago

You mean a network mounted shared server/disk? Not sure how pdftk handles that to be completely honest.. I'm currently way too busy to dig deep into this but you're welcome to debug the code and create a Pull Request if this is in fact a bug in this wrapper library and not in pdftk.