Forum Bugs

price stopped working

shahar
i am using prince for some time.
i use nodejs
prince stopped working ad i didnt made any changes.

this is my code:

const Prince = require("prince")
const util = require("util")

const timeStamp = +new Date();

Prince()
.inputs("1679928942030.html")
.output(`${timeStamp}.pdf`)
.execute()
.then(function () {
console.log("OK: done")
}, function (error) {
console.log("ERROR: ", util.inspect(error))
})

this is the error:

{
error: Error: Command failed: C:\Projects\pbd\html2pdf31.11.22\node_modules\prince\prince\program files\Prince\Engine\bin\prince.exe --prefix C:\Projects\pbd\html2pdf31.11.22\node_modules\prince\prince\program files\Prince\Engine 679928942030.html --output 1679932182683.pdf
prince: 679928942030.html: error: can't open input file: No such file or directory
prince: 679928942030.html: error: could not load input file
prince: error: failed to load all input documents

at ChildProcess.exithandler (child_process.js:390:12)
at ChildProcess.emit (events.js:400:28)
at maybeClose (internal/child_process.js:1055:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
killed: false,
signal: null,
cmd: 'C:\\Projects\\pbd\\html2pdf31.11.22\\node_modules\\prince\\prince\\program files\\Prince\\Engine\\bin\\prince.exe --prefix C:\\Projects\\pbd\\html2pdf31.11.22\\node_modules\\prince\\prince\\program files\\Prince\\Engine 679928942030.html --output 1679932182683.pdf'
},
stdout: <Buffer >,
stderr: <Buffer 70 72 69 6e 63 65 3a 20 36 37 39 39 32 38 39 34 32 30 33 30 2e 68 74 6d 6c 3a 20 65 72 72 6f 72 3a 20 63 61
6e 27 74 20 6f 70 65 6e 20 69 6e 70 75 74 ... 146 more bytes>
}
PS C:\Projects\pbd\html2pdf31.11.22> node server-new.js
ERROR: {
error: Error: Command failed: C:\Projects\pbd\html2pdf31.11.22\node_modules\prince\prince\program files\Prince\Engine\bin\prince.exe --prefix C:\Projects\pbd\html2pdf31.11.22\node_modules\prince\prince\program files\Prince\Engine 1679928942030.html --output 1679932201481.pdf

at ChildProcess.exithandler (child_process.js:390:12)
at ChildProcess.emit (events.js:400:28)
at maybeClose (internal/child_process.js:1055:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
killed: true,
code: null,
signal: 'SIGTERM',
cmd: 'C:\\Projects\\pbd\\html2pdf31.11.22\\node_modules\\prince\\prince\\program files\\Prince\\Engine\\bin\\prince.exe --prefix C:\\Projects\\pbd\\html2pdf31.11.22\\node_modules\\prince\\prince\\program files\\Prince\\Engine 1679928942030.html --output 1679932201481.pdf'
},
stdout: <Buffer >,
stderr: <Buffer >
}
mikeday
Does the input file exist? And is the filename 1679928942030.html or 679928942030.html?
shahar
the file exists and its name is 1679928942030.html
pjrm
It looks as if there's a problem in one of the javascript files that's calling prince: notice that some of the error messages say "167...html" while some say "67...html". Following the chain of error handlers should give a clue as to where the corruption is occurring.

The bytes in the value for stderr above (where it says "stderr: <Buffer 70 72 69 ...") correspond to "prince: 679928942030.html: error: can't open input", i.e. without the 1; whereas all following error messages include the 1.

[Where "following" means following in the combined error message as included in the original forum message, rather than following error as ordered by time of occurrence at runtime.]

The .js source file names appearing in the error message might also give a clue as to where the problem is occuring. You might be able to add a console.log() call giving the HTML filename as seen by each place in the stack trace.