I received a requirement from a client that if the size of the report is greater than 50MB, then split the report.
Is there any way to do this?
Posts made by orenww
-
How to split the PDF in case the report is larger than a certain size?
-
RE: New page inside loop (#each)
I'm trying to just copy the first example (the title part), where is my mistake?
- I don't see any change.
- I put debugger in the handlebar file and it doesn't stop.
const result = await jsreport.render({ template: { content:this.contnet, engine: 'handlebars', recipe: 'chrome-pdf', chrome: { displayHeaderFooter: true, headerTemplate: ` <html> <head> <style> * { box-sizing: border-box; } html, body { margin: 0px; padding: 0px; } .main { display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: 100%; } .header { width: 100%; padding-top: 20px; border-bottom: 1px solid black; } .footer { width: 100%; padding-bottom: 20px; border-top: 1px solid black; } </style> </head> <body> {{#each $pdf.pages}} {{#if 1}} <div style="page-break-before: always;"></div> {{/if}} <main class="main"> <header class="header"> Header </header> <footer class="footer"> <span>Page {{getPageNumber 1}} of {{getTotalPages ../$pdf.pages}}</span> </footer> </main> {{/each}} </body> </html>` }, helpers:this.helper, }, data: this.data })
-
RE: New page inside loop (#each)
I didn't understand how to use the examples
-
RE: New page inside loop (#each)
Where can I find a detailed example of using pfd-utils in a script (nodejs)?
-
New page inside loop (#each)
Hi
How can I know when a new page is created inside a loop (#each) ?
I would like to know and put a title on each pagefor example:
//Code{{#each XXX}}
<div class="label">
{{item}}
</div>
{{/each}}//report
-
RE: Error occurred during reporter init: Error: Cannot find module 'handlebars'
My code:
...
jsreport.use(require('@jsreport/jsreport-chrome-pdf')())
jsreport.use(require('@jsreport/jsreport-handlebars')())
jsreport.use(require('@jsreport/jsreport-assets')({
searchOnDiskIfNotFoundInStore: true,
allowedFiles: '/.',
allowLocalFilesAccess: true
}))
...const result = await jsreport.render({
template: {
content:this.contnet,
engine: 'handlebars',
recipe: 'chrome-pdf',
helpers:this.helper
},
data: this.data
}) -
RE: Error occurred during reporter init: Error: Cannot find module 'handlebars'
Thanks for your response.
I couldn't understand from the above link what should I do?
Is a recommended way to package node project that include jsReport to exe?
In previous projects (without jsReport) I used "pkg" and it worked well.Does jsReport has support?
Thanks
-
Error occurred during reporter init: Error: Cannot find module 'handlebars'
When I work in my dev env everything is OK.
But when I pack my project using "pkg", I got the following error.2022-07-28T12:00:52.239Z - error: Error occurred during reporter init: Error: Cannot find module 'handlebars'
Require stack:- C:\snapshot\bmi\node_modules@jsreport\jsreport-handlebars\lib\worker.js
- C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\extensionsManager.js
- C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\reporter.js
- C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\workerHandler.js
- C:\snapshot\bmi\node_modules@jsreport\advanced-workers\lib\workerHandler.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at module.exports (C:\snapshot\bmi\node_modules@jsreport\jsreport-handlebars\lib\worker.js:4:121)
at Object.init (C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\extensionsManager.js:12:74)
at WorkerReporter.init (C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\reporter.js:52:34)
at Object.init (C:\snapshot\bmi\node_modules@jsreport\jsreport-core\lib\worker\workerHandler.js:16:23)
at init (C:\snapshot\bmi\node_modules@jsreport\advanced-workers\lib\workerHandler.js:89:23)
at processAndResponse (C:\snapshot\bmi\node_modules@jsreport\advanced-workers\lib\workerHandler.js:43:23)
at MessagePort.<anonymous> (C:\snapshot\bmi\node_modules@jsreport\advanced-workers\lib\workerHandler.js:98:12)
2022-07-28T12:07:43.430Z - info: Initializing jsreport (version: 3.6.1, configuration file: none, nodejs: 16.16.0)
-
How to use "childTemplate" in nodejs
Hi
I have my own node server I generate report more or less like in the following example :
https://www.npmjs.com/package/@jsreport/jsreport-coreI try to use "childTemplate"
- I added "jsreport.use(require('@jsreport/jsreport-child-templates')())"
- In my primary HTML I add the following
"{{childTemplate "/modules/caseDetails/main"}}"
I got an error:
"'Error when evaluating engine handlebars for template anonymous
Engine must be specified'"- What "main" should be? an HTML ? or a file that behaves like the example in https://www.npmjs.com/package/@jsreport/jsreport-core
and if so how should I use it.
Thanks