wubzz / pdf-merge

Merge multiple PDF Files into a single PDF document

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled rejection Error: Command failed (The operation timed out)

pwong2 opened this issue · comments

@wubzz can you help me on this one please? I find the error message too generic and can't find any wrong in my code.

Unhandled rejection Error: Command failed: C:\Program Files (x86)\PDFtk\bin\pdftk.exe "D:/Clone Repositories/Website/pdfconverter/temp/31369.pdf" "D:/Clone Repositories/Website/pdfconverter/temp/31370.pdf" "D:/Clone Repositories/Website/pdfconverter/temp/31371.pdf" "D:/Clone Repositories/Website/pdfconverter/temp/31372.pdf" "D:/Clone Repositories/Website/pdfconverter/temp/31373.pdf" "D:/Clone Repositories/Website/pdfconverter/temp/31374.pdf" cat output C:\WINDOWS\TEMP\tmp-19112CuG9TkyxhgWj
Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31369.pdf"

Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31370.pdf"

Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31371.pdf"

Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31372.pdf"

Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31373.pdf"

Error: Unable to find file.

Error: Failed to open PDF file: 

   "D:/Clone Repositories/Website/pdfconverter/temp/31374.pdf"

Errors encountered.  No output created.

Done.  Input errors, so no output created.


    at ChildProcess.exithandler (child_process.js:213:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:829:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

my code is:

const PDFMerge = require('pdf-merge');
const path = 'D:/Clone Repositories/Website/pdfconverter/temp'
const pdfFiles = fs.readdirSync(path).map((file) => [path, file].join('/'));
 PDFMerge(pdfFiles, { output: 'batch\\batch1.pdf', libPath: 'C:\\Program Files (x86)\\PDFtk\\bin\\pdftk.exe' })
                    .then(() => {
                        res.writeHead(200);
                        res.end();
                    });

thanks in advance

commented

@pwong2 I don't understand how I am to help you. The error message is clear in my opinon. It can't find the files you have submitted.

@wubzz Is there other reason why these 2 error messages appear?

Error: Unable to find file.
Error: Failed to open PDF file: 

The files are existing in the said path..

commented

Seems like #14 caused this error. I've published a new version which reverts that pull request.

@wubzz thanks mate! it's now working on pdf-merge@1.0.2