Thanks a lot, worked for me.
In my local environment, I'm able to successfully render a PDF with 12 charts distributed across two pages. However, when I attempt to replicate this within a Docker container, the output changes and I end up with each chart occupying a separate page. Is there any way to fix this?
rohith-n-n
@rohith-n-n
Posts made by rohith-n-n
-
RE: Unable to run pdf in docker node18.19
-
RE: Unable to run pdf in docker node18.19
#Use the jsreport/jsreport image version 4.2.0 as the base image
FROM jsreport/jsreport:latest-fullUSER root
RUN npm i handlebars-intl --save
COPY --chown=jsreport:jsreport jsreport.config.json /app
COPY --chown=jsreport:jsreport /data /app/dataCMD [ "npm", "start" ]
I used this docker file and it works fine. But I was using the code you fixed related to preprocessing in xlsx https://forum.jsreport.net/topic/3030/change-in-file-type-after-importing-xlsx-file/6 post install. As I am not able to modify loop.js in node_modules inside docker, is there any way to get those changes now?
-
RE: Unable to run pdf in docker node18.19
This is the dockerfile
Use the jsreport/jsreport image version 4.2.0 as the base image
FROM jsreport/jsreport:latest-fullUSER root
COPY . .
CMD [ "npm", "start" ]
-
RE: Unable to run pdf in docker node18.19
I am using jsreport latest docker image and mounted the data and configuration files to container. I am not able to render pdf because of below error
Could not find Chrome (ver. 121.0.6167.85). This can occur if either
- you did not perform an installation before running the script (e.g.
npx puppeteer browsers install chrome
) or - your cache path is incorrectly configured (which is: /app/.puppeteer-cache).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
Error: Could not find Chrome (ver. 121.0.6167.85). This can occur if either
- you did not perform an installation before running the script (e.g.
-
RE: Unable to run pdf in docker node18.19
#This is docker file
FROM node:18.19.0
WORKDIR /usr/src/app
COPY . .
RUN npm run setup
EXPOSE 9012
CMD [ "node", "server.js" ]
-
Unable to run pdf in docker node18.19
While running pdf template on docker container, I am getting below error. It is working outside docker.
Report "basicCharts" render failed.
Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT
TROUBLESHOOTING: https://pptr.dev/troubleshooting
Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (/usr/src/app/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24) at ChildProcess.emit (node:events:517:28) at ChildProcess._handle.onexit (node:internal/child_process:290:12) at onErrorNT (node:internal/child_process:477:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
-
RE: asset encoded as dataURI needs to have file extension
The issue was with the data migration. I created new data source for template and it works fine.
-
asset encoded as dataURI needs to have file extension
I have migrated jsreport from v2 to v4. When I run the charts template, I am getting below error.
Error when processing render request 2
(because) asset encoded as dataURI needs to have file extension jpeg|jpg|gif|png|svg|woff|tff|otf|woff2|eot
Error: Asset encoded as dataURI needs to have file extension jpeg|jpg|gif|png|svg|woff|tff|otf|woff2|eot
at module.exports (/home/rohith/veracode/js-report/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
at WorkerReporter.createError (/home/rohith/veracode/js-report/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:49:12)
at convert (/home/rohith/veracode/js-report/node_modules/@jsreport/jsreport-assets/lib/worker.js:53:24)
at /home/rohith/veracode/js-report/node_modules/async-replace-with-limit/async-replace.js:73:26Here is the code which was used in v2 working fine:
var logoElement = document.createElement('img');
logoElement.setAttribute('class', 'col-sm logo');
logoElement.setAttribute('src', '{#asset {{logo}} @encoding=dataURI}'); -
RE: Change in file type after importing xlsx file
The problem in the original file was executing formulas. During debugging I found many xml chunks throwing error. In each chunk I removed the formula mentioned in the last cell. In the below example(N17). After those changes I was able to render template.
Example xml chunk:
<calcChain xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><c r="B12" i="5" l="1"/><c r="B11" i="5"/><c r="B10" i="5"/><c r="B9" i="5"/><c r="B8" i="5"/><c r="B7" i="5"/><c r="B6" i="5"/><c r="B5" i="5"/><c r="B4" i="5"/><c r="B3" i="5"/><c r="B2" i="5"/><c r="B1" i="5"/><c r="M21" i="1"/><c r="L21" i="1"/><c r="M20" i="1"/><c r="L20" i="1"/><c r="M19" i="1"/><c r="L19" i="1"/><c r="E19" i="1"/><c r="D19" i="1"/><c r="M18" i="1"/><c r="L18" i="1"/><c r="E18" i="1"/><c r="D18" i="1"/><c r="M17" i="1"/><c r="L17" i="1"/><c r="E17" i="1"/><c r="D17" i="1"/><c r="F17" i="1" s="1"/><c r="E16" i="1"/><c r="D16" i="1"/><c r="F16" i="1" s="1"/><c r="E15" i="1"/><c r="D15" i="1"/><c r="F15" i="1" s="1"/><c r="M14" i="1"/><c r="L14" i="1"/><c r="N14" i="1" s="1"/><c r="E14" i="1"/><c r="D14" i="1"/><c r="M13" i="1"/><c r="L13" i="1"/><c r="E13" i="1"/><c r="D13" i="1"/><c r="M12" i="1"/><c r="L12" i="1"/><c r="E12" i="1"/><c r="D12" i="1"/><c r="M11" i="1"/><c r="L11" i="1"/><c r="E11" i="1"/><c r="D11" i="1"/><c r="F11" i="1" s="1"/><c r="M10" i="1"/><c r="L10" i="1"/><c r="E10" i="1"/><c r="D10" i="1"/><c r="M9" i="1"/><c r="L9" i="1"/><c r="L15" i="1" s="1"/><c r="E9" i="1"/><c r="D9" i="1"/><c r="E8" i="1"/><c r="E23" i="1" s="1"/><c r="D8" i="1"/><c r="C4" i="1"/><c r="D23" i="1" l="1"/><c r="F9" i="1"/><c r="N9" i="1"/><c r="F10" i="1"/><c r="N10" i="1"/><c r="N11" i="1"/><c r="F12" i="1"/><c r="N12" i="1"/><c r="F13" i="1"/><c r="N13" i="1"/><c r="F14" i="1"/><c r="F18" i="1"/><c r="N18" i="1"/><c r="F19" i="1"/><c r="N19" i="1"/><c r="N20" i="1"/><c r="L22" i="1"/><c r="N21" i="1"/><c r="F6" i="1"/><c r="L23" i="1"/><c r="N6" i="1" s="1"/><c r="F8" i="1"/><c r="N17" i="1"/></calcChain>I tried to replicate the same issue but I am not able to perform B5=SUM(B2:B4). I have updated xlsx template. Please check.
Thank you!!
-
RE: Change in file type after importing xlsx file
I used the code you have pushed to master, previous error is resolved. But now I am facing below issue
Invalid character in entity name
Line: 1
Column: 4873
Char:
Error: Invalid character in entity name
Line: 1
Column: 4873
Char:
at error (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:651:10)
at strictFail (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:677:7)
at SAXParser.write (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:1491:13)