PhantomPDF CSS3 Grid


  • administrators

    electron is a project that moves very fast, they release very often. probably our electron version in playground is just an old one that does not have CSS Grid support. but as you may saw in jsreport-electron-pdf docs you can install any version of electron in your machine, so my recommendation would be to try it locally on your machine installing a latest version of electron.



  • Ah nice. Thank you. I have a new issue now. I've installed electron-pdf on a local instance of jsreport, however this keeps happening:

    Error occured - Error during rendering report: Timeout when executing in electron
    logs:
    +0 Starting rendering request 1139
    +0 Rendering template {shortid:rkJTnK2ce, recipe:electron-pdf,engine:handlebars}
    +0 Adding sample data Sy5S19ncg
    +10 Replaced assets ["Bariol.ttf","NotoSans-Regular.ttf","invoice.css"]
    +10 Resources not defined for this template.
    +10 Base url not specified, skipping its injection.
    +11 Rendering engine handlebars
    +59 Taking compiled template from engine cache
    +90 Replaced images ["SNIPPED"]
    +92 Executing recipe electron-pdf
    Stak - Error: Timeout when executing in electron
    at Timeout._onTimeout (/usr/src/app/node_modules/electron-html-to/lib/dedicatedProcessStrategy.js:272:20)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)



  • Hang on, I'm going to try the jsreport docker image with electron-pdf pre-installed. If it works I'll figure the above out then. Thanks for the help!



  • Bingo! That worked. Thanks man. I guess I'll have to use the work around for the headers and footers. Appreciate your patience. Cheers.



  • One question. Is there anyway to enforce custom margin sizes in electron-pdf rather than using the three settings? I'd like to enforce the margin using CSS, but when content propagates across more than one page (a table) the CSS margin isn't enforced.



  • Think I found a nice work around. Page media formatting module (https://www.w3.org/TR/2013/WD-css3-page-20130314):

    @page {
    margin: 20px;
    }

    Set the electron-pdf margin setting to "Default" in jsreport, and it seems to over-ride whatever margin was in place before, while propagating across multiple pages.



  • This post is deleted!


  • To conclude, unfortunately Electron doesn't seem to fully support the @page spec. I understand weasyprint does but that doesn't support grid. This is incredibly frustrating.


  • administrators

    @psutton00 i feel you, no browser out there support the Paged media module completely (except for the weasyprint engine, but they lack other features too, seems like they chose the trade off of having really great support for the Paged module but sacrificing latest CSS, JS features), and if they do, things will be really more simple to do. our best chance here is chrome, hopefully one day they will see how many people are interested in this CSS feature, until then we just have to use ugly workarounds.



  • This post is deleted!

Log in to reply
 

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