follow up question for the answer :
as pdfjs is already installed package in JSreport why do we need to use jsreport.npm.require
?
follow up question for the answer :
as pdfjs is already installed package in JSreport why do we need to use jsreport.npm.require
?
Yes ,
The json body is encrypted, for that i cannot use beforeRender.
first action is to decrypt the req.body and then start ..
When using the API route Im expecting to get the a valid request but the json will be encrypted.
I cannot use beforeRender or decode the json, i need to use an express middleware.
Can you please provide some guide for this ? TY
@bjrmatos @jan_blaha
You can see the example from the documentation,
https://jsreport.net/learn/docx#docximage
to make it works with multiple images just add a loop around the image placeholder.
Another wild option is using Docx as the base template, so Page number + TOC will be cover ,
The content will be html that will be create in a beforeRender script ..
I want to create document structure that will include:
the actual content of the document is a dynamic Template so using Components/childTemplate looks like the best option.
Another requirement is that the Component/childTemplate body will be provided from a API call .
Using the playground example for Components/childTemplate looks like the actual content is store in the DB.
Here are my questions ?
Thank you for the help
@jan_blaha same code ,then i just add this line :
async function afterRender(req, res) {}
and got the error ..
@jan_blaha still having issue.. not working using API
Cannot set property offset of [object Object] which has only a getter
@jan_blaha TY for the quick response 🙏 Working now
A better option is to implement this in the unoconv extension as additional input and use unoconv password option (although it is deprecated )
I manage to add password to a converted pdf (unoconv) using a script and static-pdf ,
Now trying to move the script to be global and getting error - for the same script,
Can you assist ? @bjrmatos @jan_blaha
https://playground.jsreport.net/w/benben-user/KNTuB2lm
const jsreport = require('jsreport-proxy')
async function afterRender(req, res) {
if (req.data?.password) {
myjson = {
"template": {
"recipe": "static-pdf",
"content": "",
"engine": "handlebars",
"staticPdf": {
"pdfAsset": {
"content": res.content.toString('base64'),
"encoding": "base64"
}
},
"pdfPassword": {
"password": req.data?.password,
"ownerPassword": req.data?.password
}
}
}
const result = await jsreport.render(myjson)
res.content = result.content;
}
}
error
Hi,
I was not able to make docxRaw example work ,
see example https://playground.jsreport.net/w/benben-user/t7NNI9z3
can you please assist @bjrmatos @jan_blaha
I have an excel recipe, 1 tab with simple table.
I need to return the report as CSV format,
What is the simplest way to do it ? (don't want to replace recipe to text or html)
afterRender ?
maybe use sheetjs like in this example link ?
var csv = XLSX.utils.sheet_to_csv(worksheet, opts);
TY
I need to include some tags to external application in the generated word document (docx recipe) ,
The tag looks like this: {{Cmpy_es_:signer1:company}} .
I was not able to include this in the template, some example to what i tried to do:
\{{Cmpy_es_:signer1:company}} --> this is working in html
\\{{Cmpy_es_:signer1:company}}
/\{{Cmpy_es_:signer1:company}}
is it possible in docx recipe ?
@jan_blaha @bjrmatos