In the above example you are using a child template named "Image in header header" where you placed image tag and also in main template image is a placed with display none. For this I need to create child template. I am using Post api for pdf view. Is this possible to create child template and then use it in main template through post api. Actually I am creating template on run time on the base of options and also need images in the header and footer.
Can you please tell me how we can create child template using POST API or there is any other option to do that?
aftabrehman1001
@aftabrehman1001
Posts made by aftabrehman1001
-
RE: Phantom-Pdf Header Footer images in Template
-
Phantom-Pdf Header Footer images in Template
I want to display header and footer images in template. As you mentioned in your documentation we need to add image in the content template with visible off. According to your documentation we need to use child template for displaying header and footer. My basic question is how we can create child template using POST API as I am using jsreport api to get pdf view. I have attached some piece of code to get understand. I am using jsreport 1.9.2 and other thing when ever I use header and footer option through Phantom options its returns nothing. So I follow your instructions through multiple forums having detail that we need to use child templates for header and footer.
var helper = ' ';
var phantomOptions = JSON.parse('{ "format": "A4" ,"orientation": "landscape" ,"margin": { "top": "1px", "left": "1px", "right": "1px", "bottom": "1px" } }');phantomOptions.Header = "hello header"; phantomOptions.Footer = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOGF0ZTptb2RpZnkAMjAxNy0wNC0yNVQxMDoyOTowNyswMjowMH8oHHgAAAAASUVORK5CYII=" height="50" width="50">';*/ var templateDataJson = JSON.stringify(templateData.dataJson), templateObject = { "content": '<div>Hello world</div>', "engine": "handlebars", "recipe": "phantom-pdf", "phantom": phantomOptions, "helpers": "", shortid: (new Date().getTime()) }, tData = { template: templateObject, data: '', options: { "reports": { "save": true } } }
By using this approach how can i create child template and can use it in main template.
-
RE: JSREPORT specific file name to store
Thanks @bjrmatos can i get generated file name after report generation??
-
Custom File Name
Hi
I am generating pdf reports using here is my log file entry- debug: Report stored as WMD6qfwx72SZz2xi.pdf requestId=6
I want to specify my own file name instead of this auto generated file name.Please help
-
RE: JSREPORT specific file name to store
Hi @bjrmatos thanks for your answer
Here is my dev.config.json file in which i have following settings
"dataDirectory": "D:\test",
"tempDirectory":"D:\test"
Now every report is generated according to my configured directory in Storage folder under this directory.On frontend implementataion i am adding options in form body as given blow
addBody("template", template);addBody("options", options); addBody("data", JSON.stringify(data)); //addBody("options", JSON.stringify('"reports": { "save": true }')) var headers = jsreport.headers; headers["host-cookie"] = document.cookie; headers["content-type"] = "application/json"; addBody("headers", headers); document.body.appendChild(mapForm); mapForm.submit();
Is there any possible override available for file name i want to set user defined filename.
-
JSREPORT specific file name to store
Hi All
Is want to store pdf in a specific directory with custom file name.i want to give my own file name.Is there any way to do it.
-
JSREPORT Save report to specific folder/Directory
Hi All,
Is there any option available for saving reports into specific folder/directory.