ProtocolError: Protocol error (Page.printToPDF): Printing failed
-
Hi,
I am trying to generate PDF with large dataset using the chrome-pdf engine.
I got success for around 3000 data (100 pages). But for 3500 or greater amount of data, it fails with status 500 with the following message.ProtocolError: Protocol error (Page.printToPDF): Printing failed
at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:62:35)
at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:108:26)
at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:224:26)
at CDPSessionImpl.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:433:78)
at CDPPage.createPDFStream (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:738:88)
at CDPPage.pdf (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:771:37)
at /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:391:27
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:432:22About jsreport engine:
- Using jsreport online server
- jsreportonline version: 3.13.2
- jsreport version: 3.13.0
Kindly suggest us the possible workaround.
-
Please try to disable the accessibility tags generation
https://jsreport.net/learn/chrome-pdf#aria
-
Hi,
I have added the aria-hidden="true" tags like below.<html>
<head>
......
</head><body aria-hidden="true"> <div class="container"> ......... </div> <script> </script> </body>
</html>
For Small dataset, jsreport is working as before.
But for larger dataset (eg. 3500 data), i am getting a new error :Error: Page crashed!\n at CDPPage._CDPPage_onTargetCrashed (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:881:24)
at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:221:100
at /app/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:3:248
at Array.map (<anonymous>)\n at Object.emit (/app/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:3:232)
at CDPSessionImpl.emit (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:87:22)
at CDPSessionImpl._onMessage (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:449:18)
at Connection.onMessage (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:277:25)
at WebSocket.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NodeWebSocketTransport.js:62:32)
at callListener (/app/node_modules/ws/lib/event-target.js:290:14)I also tried to add this tag inside container
div
. But that gives us previous error :
ProtocolError: Protocol error (Page.printToPDF): Printing failed
-
Don't you use big images in your template? If that is the case please check the following
https://jsreport.net/learn/chrome-pdf#images-increasing-pdf-size
-
Hi,
I have not used any image. So image optimization might not be suitable here.
I am using kendo library to design the pdf. My Pdf mostly contains a table with large set of data rows.Here is my current structure of the template :
<html> <head> <script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity=".." crossorigin="anonymous"></script> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.default-v2.min.css" /> <script src="https://kendo.cdn.telerik.com/2021.2.616/js/jquery.min.js"></script> <script src="https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js"></script> <style> {#asset ../global.css @encoding=utf8} </style> </head> <body aria-hidden="true"> ..... </div> <script> .... $("#grid").kendoGrid({ dataSource: { data: dataValue }, transitions: false, scrollable: true, pageable: false, groupable: true, columns: columns, noRecords: true, pageable: { pageSizes: false, previousNext: false, numeric: false, } }); </script> </body> </html>
I am still getting the above mentioned errors.
It will be a great help if you could suggest some more approach on how we could avoid this error.
-
I'm afraid I don't have other hints.
Did you try to run the report locally?
jsreportonline containers have memory limits and chrome can also crash because of insufficient resources.