You can use assets to reuse code between scripts.
https://jsreport.net/learn/assets#require-asset
Posts made by admin
-
RE: How can I use one script inside another script?
-
RE: Using Handlebars `@ index` inside a component
I'm not sure how to fix it. It is too abstract. However the problem is the following...
async function componentWrapper(name, opts) { // here you let evaluate the `Number: {{1}}` code, but the `#each` haven't even started const childValue = await jsreport.templatingEngines.waitForAsyncHelper(opts.fn(this)) // here you invoke `Footer` component with each return component.call({ ...opts.data, child: childValue }, name, opts) }
-
RE: Using jsreport/jsreport:4.8.0 and html-to-xlsx recipe ends always in timeout Error: script evaluation not completed after...
You need to add the following env because of the chrome update
docker run -p 5488:5488 -e "chrome_launchOptions_args=--no-sandbox, --disable-dev-shm-usage, --disable-gpu" jsreport/jsreport:4.8.0
-
RE: Timeout Issue When Generating Large PDFs (On-Premise, Enterprise License)
Hm, I still think there must be some kind of network infrastructure that interrupts the request when it doesn't send a response in 30s....
What if you try a template that waits 40s, like a template with this in the helpers
await new Promise((resolve) => setTimeout(resolve, 40000)
Does that fail on the same error?
If yes, then can you try to install jsreport on your local and try to render it locally, does that fail as well?
-
RE: Increase rendering time in same short template on Windows and got 0kb when receive the ETIMEDOUT error
Unfortunately, I have even no theory why windows security patch breaks things.
-
RE: Differences in PDF generated by Docker Image 4.7.0 and 4.7.0-full
This is likely because the full image has additinal fonts installed. Try to create an image like this from the default one. This should add text to the svg when converting the jsreport sample invoice template.
FROM jsreport/jsreport:4.7.0 RUN set -x \ && apk add --no-cache \ font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra
-
RE: Increase rendering time in same short template on Windows and got 0kb when receive the ETIMEDOUT error
Ah ok, this is the IP address where jsreport uploads the office files for preview. However this is happening only when you run the preview request and display the output in the office live browser's app. jsreport isn't reaching this ip in other cases. Also it never goes to the port 90 where nothing is running. So that is very strange.
I can imagine that the security patch breaks some kind of networking. However maybe there is a jsreport bug that you just didn't notice. jsreport 2.4.0 is 6years old. Perhaps you can update jsreport. At least to jsreport 2.11.0 which shouldn't have breaking changes.
-
RE: jsreport Error when trying to run the pdf
You are using the following absolute path to reference an asset
/TS130/IT/Master/DdT/Sales/helpers.js
However the correct path is
/REVISO/TS130/IT/Master/DdT/Sales/helpers.js
Or you can use relative paths to the template
./helpers.js
-
RE: Increase rendering time in same short template on Windows and got 0kb when receive the ETIMEDOUT error
Could you tell me what is the ip/port mentioned in the error? 68.219.241.39:80
Could you try to change the configs
extensions.scripts.strategy="dedicated-process"
andtemplatingEngines.strategy="dedicated-process"
-
RE: Issue with Memory Consumption and OOM Errors When Using docxImage with Base64 Images
I noticed that the same issue is occurring in the docxHtml helper
I've updated the task
Also, do you have an estimated timeframe for when this might be picked up?
We have currently long queue with
docx
recipes task. It can take a month to get to this I guess. -
RE: Issue with Memory Consumption and OOM Errors When Using docxImage with Base64 Images
Thank you for the ticket. It makes sense.
I've submited task to backlog to deal with it.
https://github.com/jsreport/jsreport/issues/1216 -
RE: Upgrade path from 2.8 to latest version
It's recommended to do it locally and then upload to prod the migrated app.
You should the first migrate to v3
https://jsreport.net/learn/v3-migration-guideThen update to v4
https://jsreport.net/blog/jsreport-400-release -
RE: Informative error message for docx templates
Thanks for submitting this problem here.
I've submitted a task to our backlog to add some context to the docx errors.
https://github.com/jsreport/jsreport/issues/1214I'm afraid there isn't a solution for this now, so we will try to prioritize the mentioned task.
-
RE: Version 3.13 and jsreport-electron-pdf in Fargate
You can see here how we solve the problem with running electron in docker
https://github.com/jsreport/playground-worker/blob/4.3.0/DockerfileNote the Fargate isn't able to run dockerized the new Chrome at this moment. It may change with the next Chrome version. However, it may easily end up, that Fargate hosts are missconfigured and can't run the latest Chrome, and we will have to wait until AWS or Chrome team fix it.
https://github.com/jsreport/jsreport/issues/1207 -
RE: Version 3.13 and jsreport-electron-pdf in Fargate
These versions work for me together... On windows, not sure how on Fargate
"@jsreport/jsreport-electron-pdf": "4.0.0", "jsreport": "3.3.0", "electron": "1.6.6"
Doesn't the chrome-pdf give you similar output as the electron-pdf?
We will have to remove electron from the jsreportonline this year anyway because otherwise we can't go further with the service. -
RE: Using async helper functions with #each in jsreport Handlebars
This should work
https://playground.jsreport.net/w/anon/6OBgbZhKasync function getAsyncItems() { console.log("getAsyncItems"); return ["async1","async2"]; } const jsreport = require('jsreport-proxy') async function asyncEach(data, opts) { let r = '' let realData = await jsreport.templatingEngines.waitForAsyncHelper(data) for (let item of realData) { r += opts.fn(item) } return r }
{{#asyncEach (getAsyncItems)}} <h2>{{this}}</h2> {{/asyncEach}}
-
RE: Chrome-PDF: Start Page Number after first page
You won't be able to solve this with the native Chrome headers because they are static.
jsreport solves this by merging two PDFs. One with the main content and one with a dynamic header.
Here you can find the documentation
https://jsreport.net/learn/pdf-utilsAnd here is a demo already including the skip of the first page.
https://playground.jsreport.net/w/anon/4VLIqg97 -
RE: Icon/emoji in PDF graphical representation
Icon emoji is a Unicode character rendered by font. So if you paste this to your html
<span>🚫</span>
thechrome-pdf
should convert it to your icon. This works on Windows because there are required fonts already installed, however, on linux you typically need an extra fonts.Here you can find demo with open moji web fonts used to render emoji.
https://playground.jsreport.net/w/anon/sLgBfpQB -
RE: Unicode not rendering with chrome-pdf
There seems to be support for emoji also through web fonts without a need to install something now.
https://playground.jsreport.net/w/anon/sLgBfpQB -
RE: How to install latest commit from git ?
I am afraid that is the downside of the monorepo...
I guess the easiest is to just replace the affected files "manually". This means with aDockerfile
step or with some script.