Chrome-pdf not working
-
Hi I am trying to integrate chrome-pdf to my .net core app. I used to use electron-pdf to generate pdfs and that works fine, but I want to add page numbers and repeating headers to my pdfs. I have installed chrome-pdf as per the installation instructions and I get this error:
2018-04-17T04:57:54.704Z - info: Using extension chrome-pdf
2018-04-17T04:57:54.707Z - error: Error when loading extension SyntaxError: Unexpected token (
SyntaxError: Unexpected token (
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at NativeModule.require (node.js:919:21)
at s (jsreportRuntime.js:1:551)
at jsreportRuntime.js:1:742
at jsreportRuntime.js:138690:16
at tryCatcher (jsreportRuntime.js:47291:23)
at Promise._settlePromiseFromHandler (jsreportRuntime.js:45313:31)
at Promise._settlePromise (jsreportRuntime.js:45370:18)
at Promise._settlePromiseCtx (jsreportRuntime.js:45407:10)
at Async._drainQueue (jsreportRuntime.js:42225:12)
at Async._drainQueues (jsreportRuntime.js:42230:10)
at Immediate.Async.drainQueues [as _onImmediate] (jsreportRuntime.js:42104:14)
at processImmediate [as _immediateCallback] (timers.js:396:17)this is my current jsreport.config.json file:
{
"discover": true,
"logger": {
"file": { "transport": "file", "level": "verbose", "filename": "logs/log.txt" },
"error": { "transport": "file", "level": "error", "filename": "logs/error.txt" }
}
}I have tried updating my Nodejs and my npm to the latest version and reinstalling chrome-pdf and that also didn't work. I can't figure out how to solve this issue.
-
hi, are you using the .net sdk? or are you using jsreport with node directly? if you are using the .net sdk then it means that you are using the jsreport executable, which have its own version of nodejs compiled into it, the version compiled into the executable is node
4.7.3
andchrome-pdf
recipe requires node8
so it won't work there when using the node executable, at least for now, because in v2 chrome will be the default recipe and it will work normally.
-
Yeah I am using .NET Binary and .NET Local NuGet packages. Thank you for clearing this up! I might try wkhtmltopdf then