White space in header and footer - phantomPDF windows
-
Hi
I have a problem with phantomPDF on windows.
I am using jsreport cloud and have a report with header and footer.
If i use the linux phantomPDF there is no problem, but with windows I have a small gap above the header and below the footer.
The report was designed on a local windows machine, so it it a big task to rewrite the styling to linux.Look at this image:
https://www.dropbox.com/s/vj7rtkmciaz9pld/Untitled2.png?dl=0
The grey box is the header. If i place anything above it with position:absolute and top:-10px it will just clip the content and not show it.Margin is set to 0cm in pahntom PDF
-
Hi,
this is probably phantomjs bug, but we recently implemented recipe improvement which should enable a workaround for it.
See here
https://github.com/jsreport/jsreport-phantom-pdf/pull/17It is not part of the jsreportonline yet, but you should be able to specify the top margin using custom script like this already:
function beforeRender(req, res, done) { req.template.phantom.margin = { top: '0px', left: '50px' } done() }
Another option is to try this css which could convert your windows based design to linux one
https://jsreport.net/learn/phantom-pdf#different-sizes-on-windows-vs-unix
-
Hi Jan
The script did not work.
Out customer will have to deal with the extra white space for now :)Is linux more reliable than the windows version? Or is it the same? I think of the next time we start a new report, if it should be the one we use for this (windows) or the linux version?
-
hi @ploeff , i usually use something like the following https://playground.jsreport.net/studio/workspace/SkJSh-qJ-/4 to ensure the same styles across Linux, Windows, OSX, so far it works great, it is just a script that detects the current OS (you will need to allow the
require('os')
in your jsreport installation) and then applies a zoom in the whole html document depending on the OS.
-
You should prefer the linux recipes in the jsreportonline. You get dedicated docker container which will be better isolated and reliable.