oj everything works its my bad.. apperently i had a password on each page mistakly because i played before and then i cloned the pages which kept the password, after i removed it from all pages everything works great, i guess theres some kind of bug calling api with password but i dont need it.
Posts made by Yan Faingold
-
RE: incorrect header check
-
RE: incorrect header check
full error:
(because) error while executing pdf-utils operations
(because) incorrect header check
Error: incorrect header check
at Zlib.zlibOnError [as onerror] (node:zlib:189:17)
at Zlib.callbackTrampoline (node:internal/async_hooks:130:17)
at processChunkSync (node:zlib:457:12)
at zlibBufferSync (node:zlib:178:12)
at Object.syncBufferWrapper [as unzipSync] (node:zlib:792:14)
at mergePage (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/pdfjs/lib/mixins/merge.js:113:31)
at merge (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/pdfjs/lib/mixins/merge.js:162:22)
at /Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/pdfjs/lib/mixins/merge.js:7:64
at Document.asBuffer (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/pdfjs/lib/document.js:66:13)
wrapped by:
Error: Error while executing pdf-utils operations
(because) incorrect header check
at module.exports (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
at WorkerReporter.createError (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:49:12)
at AsyncFunction.<anonymous> (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-pdf-utils/lib/worker.js:196:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ListenerCollection.fire (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:21)
at async afterRender (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:103:5)
at async WorkerReporter._render (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:148:7)
at async /Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:179:19
at async Domain.<anonymous> (/Users/yanfaingold/Work/osint-js-report/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:141:19) rootId=n9198612644wpv1, id=n9198612644wpv1 -
RE: incorrect header check
if i try to take the working 1 and use definition i get this (tryed to call api with this and failed script untill i remove the merge operation):
{
"name": "cover",
"recipe": "chrome-pdf",
"shortid": "IwukVzV",
"folder": {
"shortid": "0-qKPfv"
},
"_id": "g6wVDTSHHMQtNzYH",
"engine": "handlebars",
"data": {
"shortid": "T7IElFhj9"
},
"chrome": {
"printBackground": true,
"displayHeaderFooter": false,
"viewportWidth": null,
"viewportHeight": null,
"marginTop": "",
"marginBottom": "2cm",
"width": "595",
"footerTemplate": "<div>yannnnnnnnnnnnfooter</div>"
},
"creationDate": "2023-07-03T13:42:16.960Z",
"modificationDate": "2023-07-06T09:39:21.308Z",
"scripts": [
{
"shortid": "Fq58TQxq5"
}
],
"pdfPassword": {
"password": ""
},
"pdfOperations": [
{
"type": "append",
"mergeWholeDocument": true,
"templateShortid": "c5Oftl3"
},
{
"type": "merge",
"mergeWholeDocument": true,
"templateShortid": "PJyOKkL"
}
]
} -
RE: incorrect header check
it seems like theres 2 seperate issues:
- last page is not rendered for some reason, and you always get blank page.
- merge operation doesn't work except when you run directly your template from the sudio with operations, my footer file the. merges good from studio but fails in api/script:
<html>
<head>
<style>
{{asset "styles.css" "utf8"}}
{{asset "../common/styles.css" "utf8"}}
</style>
</head>
<body>
{{#each $pdf.pages}}
{{#if 3}}
<div style="page-break-before: always;"></div>
{{/if}}
<main class="main">
{{!-- <header class="header">
<div>fgdfhfg</div>
</header> --}}
<header class="header">
Header
</header>
<footer class="footer">
<div style="display:flex;justify-content: space-between;align-items:center;height:100%">
<div>
<div class="s10w500">Report generated for: {{@root.reportInfo.generatedBy}}</div>
<div class="s10w500">{{dateFormatter @root.reportInfo.dateGenerated 'MMM D, YYYY'}} | Generated by Ⓒ</div>
</div>
<div class="s12w500">{{getPageNumber 3}} out of {{getTotalPages ../$pdf.pages}}</div>
</div>
</footer>
</main>
{{/each}}
</body>
</html>fyi: also tried to remove all these details inside the footer but it keeps failing
-
RE: incorrect header check
- jsreport version is latest 3.13.0
- we dont use a store we pass a data json
- this is the api call also tried to use afterrender script but still same result:
{
"options": {
"Content-Disposition": "Attachment; filename=report.pdf"
},
"template": {
"name": "cover",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "table-of-contents",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "report-overview",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "filters",
"recipe": "chrome-pdf",
"engine": "handlebars"
},
"type": "append"
}
]
},
"type": "append"
}
]
},
"type": "append"
}
]
},
"data": {...my data object}
}
-
RE: incorrect header check
still same error with the header check, even after having a header
-
RE: incorrect header check
same here im trying to use the api call and i found how append pages from there which is weird i have to call nested pdfoperation template but it doesnt render the last page but at least it appends, my problem not is i need to merge the footer at the end to recieve current pages numbering but i can only merge before append if i try to merge after i recieve the same error, and merging before only merge 1st page footer, i want it to work the same way as in the jsreport studio pdf operation... please help!!!
call example: "options": {
"Content-Disposition": "Attachment; filename=report.pdf"
},
"template": {
"name": "cover",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "table-of-contents",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "report-overview",
"recipe": "chrome-pdf",
"engine": "handlebars",
"pdfOperations": [
{
"template": {
"name": "filters",
"recipe": "chrome-pdf",
"engine": "handlebars"
},
"type": "append"
},
{
"template": {
"name": "footer",
"recipe": "chrome-pdf",
"engine": "handlebars"
},
"type": "merge"
}
]
},
"type": "append"
}
]
},
"type": "append"
}
]
},