How to fix more data convert to PDF error?



  • I using the jsrender engine and chrome-pdf recipe to print a PDF document. the data have more picture URL, and I want print the picture in the pdf, it works well when the data less, but it can't works when the data have more.
    My template like this:

     <table class="table" style="width: 100%; margin-bottom: 15px;" ng-show="checklist.Logs.length>0">
                <tbody>
                    {{for Logs}}
                    <tr>
                        <td style="width:55%">
                                    {{:Description}} </td>
                        <td style="width:20%">
                                    {{:UserName}} </td>
                        <td style="width:12%">
                                    {{:LogDate}} </td>
                        <td style="width:13%">
                             
                            <div class="img-container-thumb">
                                {{for LogImages}}
                                <div class="img-item">
                                    
                                    <img src="{{:Url}}"/>
                                    </div>
                            {{/for}}
                                                        
                            </div>
                        </td>
                    </tr>
                    {{/for}}
                </tbody>
            </table>
    

    I got the error message like below:

    Error: Protocol error (Page.printToPDF): Target closed.
        at Promise (C:\jsreportapp\node_modules\puppeteer\lib\Connection.js:183:56)
        at new Promise (<anonymous>)
        at CDPSession.send (C:\jsreportapp\node_modules\puppeteer\lib\Connection.js:182:12)
        at Page.pdf (C:\jsreportapp\node_modules\puppeteer\lib\Page.js:926:39)
        at Page.<anonymous> (C:\jsreportapp\node_modules\puppeteer\lib\helper.js:111:23)
        at runWithTimeout (C:\jsreportapp\node_modules\jsreport-chrome-pdf\lib\conversion.js:164:27)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:189:7)
    

    I had setting my jsreport.config.json accoring the belows two posts, but my report still can't works.
    https://jsreport.net/blog/long-reports
    https://forum.jsreport.net/topic/1124/long-reports-return-unable-to-render-template-timeout-during-evaluation-of-pdf-utils-operations/3

    How to fix this issues?



  • Does the server which is rendering the report have enough memory?
    We experienced in past crashes when the provided images were big and it helped to resize them upfront before printing.



  • I have upgrade the server momory 16G, but still got the error now.
    have any other way to fix this issues?



  • @jan_blaha Have any ways resize the picture upfront before printing?



  • Perhaps you can do the resize on your end. At the server, you have your images stored.

    One thing you can try is also updating the puppeteer dependency.

    npm i puppeteer@2.1.1
    


  • We have tested the report but with less pictures and it will then be around 120mb big then. If we use Adobes compress function it will compress it to around 1.7mb.



  • @Martinahlstrom This is already solved. It will be part of the jsreport 2.7.0 which should be released very soon. We are in the middle of the release process, so not 100% sure about compatibility, but you may try this npm i jsreport-pdf-utils@1.6.0 --save to get the updated version with pdf size fix.



  • @Martinahlstrom In case you don't use pdf utils the previously mentioned won't help. In that case please try to resize the images upfront.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.