Excellent, the pdf-utils extension is working now with the patch. Thank you!
ajphillips
@ajphillips
Posts made by ajphillips
-
RE: PDF-utils with custom font causes undefined Name error
-
RE: PDF-utils with custom font causes undefined Name error
Hi Jan,
My apologies for taking so long, thank you for responding so soon. Here is playground demo that reproduces the error: https://playground.jsreport.net/w/ajphillips/PMW_yuFU
Hope that helps. Thanks!
-
PDF-utils with custom font causes undefined Name error
Hello folks,
I have JSReport running on a docker container and using a template on the pug engine with the chrome-pdf recipe. I've been trying to figure out a way that I can sign the pdf with a certificate but when I configure it via pdf-utils (or pdf-sign), I get an error with the message "A Name cannot be undefined".
Error: Error while executing pdf-utils operations. A Name cannot be undefined
at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13)
at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:332:12)
at AsyncFunction.<anonymous> (/app/node_modules/jsreport-pdf-utils/lib/main.js:382:22)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
caused by: Error: A Name cannot be undefined
at new PDFName (/app/node_modules/jsreport-pdfjs/lib/object/name.js:14:13)
at Function.parse (/app/node_modules/jsreport-pdfjs/lib/object/name.js:109:12)
at Object.exports.parse (/app/node_modules/jsreport-pdfjs/lib/object/value.js:20:30)
at Function.parse (/app/node_modules/jsreport-pdfjs/lib/object/dictionary.js:80:30)
at Object.exports.parse (/app/node_modules/jsreport-pdfjs/lib/object/value.js:20:30)
at Function.parseInner (/app/node_modules/jsreport-pdfjs/lib/object/object.js:85:28)
at Function.parse (/app/node_modules/jsreport-pdfjs/lib/object/object.js:73:27)
at parseObject (/app/node_modules/jsreport-pdfjs/lib/object/reference.js:128:22)
at PDFReference.get [as object] (/app/node_modules/jsreport-pdfjs/lib/object/reference.js:15:17)
at Function.addObjectsRecursive (/app/node_modules/jsreport-pdfjs/lib/parser/parser.js:61:35)It seems like this could be caused by a custom google font I'm using called Inconsolata.
CSS here: https://www.cssfontstack.com/Inconsolata
If I change it to Arial or Helvetica then the pdf successfully generates but this particular custom font is needed. I have tried to find workarounds for this issue but so far have been unsuccessful so any help would be greatly appreciated. Thanks! -
RE: Chromium revision not downloaded
I have not, but will try that. I will also check through my template for any other possible clues. Does that error message generally pertain to a template issue?
-
RE: Chromium revision not downloaded
Thank you @jan_blaha for the suggestions. I did not see that env in my docker container so I set it in my config along with adding the launchOption arg: "--disable-dev-shm-usage", that is specified in the base image Dockerfile you posted. This did resolve my Chromium revision download error, but when I tried to render a PDF after running my service, then this new error occurred:
Error: Navigation failed because browser has disconnected! at CDPSession.LifecycleWatcher._eventListeners.helper.addEventListener (/app/node_modules/puppeteer/lib/LifecycleWatcher.js:46:107) at emitNone (events.js:106:13) at CDPSession.emit (events.js:208:7) at CDPSession._onClosed (/app/node_modules/puppeteer/lib/Connection.js:215:10) at Connection._onClose (/app/node_modules/puppeteer/lib/Connection.js:138:15) at WebSocketTransport._ws.addEventListener.event (/app/node_modules/puppeteer/lib/WebSocketTransport.js:45:22) at WebSocket.onClose (/app/node_modules/puppeteer/node_modules/ws/lib/event-target.js:124:16) at emitTwo (events.js:126:13) at WebSocket.emit (events.js:214:7) at WebSocket.emitClose (/app/node_modules/puppeteer/node_modules/ws/lib/websocket.js:191:10) at Socket.socketOnClose (/app/node_modules/puppeteer/node_modules/ws/lib/websocket.js:850:15) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at TCP._handle.close [as _onclose] (net.js:561:12) -- ASYNC -- at Frame.<anonymous> (/app/node_modules/puppeteer/lib/helper.js:110:27) at Page.goto (/app/node_modules/puppeteer/lib/Page.js:629:49) at Page.<anonymous> (/app/node_modules/puppeteer/lib/helper.js:111:23) at runWithTimeout (/app/node_modules/jsreport-chrome-pdf/lib/conversion.js:43:16) at <anonymous> at process._tickDomainCallback (internal/process/next_tick.js:229:7)
I searched for a way to resolve this by testing changes in my Dockerfile and changing the launchOption args with no luck. My current config json looks like this:
"certificate": { "key": "*****", "cert": "*****" }, "authentication": { "cookieSession": { "secret": "*****" }, "admin": { "username": "*****", "password": "*****" }, "enabled": false }, "store": { "provider": "fs", "timeout": 1800000 }, "httpPort": 5488, "httpsPort": null, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "debug", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "blobStorage": { "provider": "fs", "timeout": 1800000 }, "phantom": { "strategy": "dedicated-process", "timeout": 1800000 }, "templatingEngines": { "strategy": "dedicated-process", "forkOptions": { "execArgv": ["--max-old-space-size=4096"] }, "numberOfWorkers": 8, "timeout": 1800000, "allowedModules": "*" }, "extensions": { "chrome-pdf": { "numberOfWorkers": 8, "timeout": 1800000, "allowLocalFilesAccess": true, "launchOptions": { "args": ["--pipe=true","--no-sandbox","--disable-dev-shm-usage"], "executablePath": "google-chrome-stable" } }, "fs-store": { "timeout": 1800000 }, "scripts": { "allowedModules": "*", "timeout": 1800000 }, "express": { "inputRequestLimit": "100mb" } }, "assets": { "publicAccessEnabled": true } }
Again, I'm not sure where to go with this so any ideas would be appreciated. Thanks!
-
Chromium revision not downloaded
Hello there, we have been using the docker image for jsreport 2.5 in a docker container with electron-pdf and now want to have this work with chrome-pdf instead. I think we have updated our
jsreport.config.json
accordingly but have run into the following issue after the change:
Error: Chromium revision is not downloaded. Run "npm install" or "yarn install" at Launcher.launch (/app/node_modules/puppeteer/lib/Launcher.js:119:15) at <anonymous>
Here is what the
jsreport.config.json
looks like:"certificate": { "key": "*****", "cert": "*****" }, "authentication": { "cookieSession": { "secret": "*****" }, "admin": { "username": "*****", "password": "*****" }, "enabled": false }, "store": { "provider": "fs", "timeout": 1800000 }, "httpPort": 5488, "httpsPort": null, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "debug", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "blobStorage": { "provider": "fs", "timeout": 1800000 }, "phantom": { "strategy": "dedicated-process", "timeout": 1800000 }, "templatingEngines": { "strategy": "dedicated-process", "forkOptions": { "execArgv": ["--max-old-space-size=4096"] }, "numberOfWorkers": 8, "timeout": 1800000, "allowedModules": "*" }, "extensions": { "chrome-pdf": { "timeout": 1800000, "strategy": "chrome-pool", "numberOfWorkers": 8, "launchOptions": { "args": ["--pipe=true", "--no-sandbox"] } }, "fs-store": { "timeout": 1800000 }, "scripts": { "allowedModules": "*", "timeout": 1800000 }, "express": { "inputRequestLimit": "200mb" } }, "assets": { "publicAccessEnabled": true } }
And here is the container's corresponding Dockerfile:
FROM jsreport/jsreport:2.5.0-full # Create the directory service group and user ## --gid 500 and "apps" correspond with same gid and group name as are used by the directory service RUN addgroup --system --gid 500 apps ## --disabled-password does not mean you cannot log in via ssh for instance ## --gecos "" -- makes adduser run non-interactively ## -u 1051 and "directorygenerator" corresponds with same uid and username as are used by the directory service RUN adduser --system --shell /bin/bash -u 1051 --gid 500 directorygenerator RUN chown -R directorygenerator:apps /app # Switch to the restricted user # USER directorygenerator # copy the configuration to the jsreport image COPY jsreport.config.json /app COPY /data /app/data # expose port 5488, technically done in base image, but here for visibility EXPOSE 5488
This particular container builds the jsreport image that is used by another service of ours which, when running, shows that Chromium revision error. I have inspected the docker container and found that the in the puppeteer module, there was no chromium-related package to be found anywhere. Any help with this issue would be appreciated.Thanks!