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.
Posts made by psutton00
-
RE: PhantomPDF CSS3 Grid
-
RE: PhantomPDF CSS3 Grid
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.
-
RE: PhantomPDF CSS3 Grid
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.
-
RE: PhantomPDF CSS3 Grid
Bingo! That worked. Thanks man. I guess I'll have to use the work around for the headers and footers. Appreciate your patience. Cheers.
-
RE: PhantomPDF CSS3 Grid
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!
-
RE: PhantomPDF CSS3 Grid
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) -
RE: PhantomPDF CSS3 Grid
Thanks for responding! My bad on the CSS3 <> grid mistake.
I've just had a look at the playground as it's got electron-pdf built-in and ready to go, however it doesn't appear to work. Is this what you're expecting:
https://playground.jsreport.net/studio/workspace/SyUrRILTg/4955
If you change to HTML generation, you'll see the grid layout I'm expecting
-
PhantomPDF CSS3 Grid
I've got a bunch of templates that I've been using in a custom solution that use CSS3's grid system (see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout). I know I could use Bootstrap, but it's pretty inferior in comparison to the native grid system, and I've seen/experienced issues with Bootstrap before (PRINT media type).
I've tried using using my templates using PhantomPDF and it's not working at all. The layout gets completely ruined. The same templates work fine with AthenaPDF (see https://github.com/arachnys/athenapdf CLI), however that lacks crucial features (document headers and footers being one).
Does PhantomPDF support CSS3? If not could it be updated to support it?
Thanks in advance.