DPI option doesn't seems to work
-
Hi Jsreport team!
Here is my issue, using
wkhtmltopdf
recipe, I was able to generate the reports that I needed for testing. However it was on localWindows
.
Now we are starting setting up the same usingDocker
onUbuntu
server and that's when things started to get funny.I'm well aware of the difference in DPI between OSes, but it is specified (as per your documentation) that the recipe as a
dpi
option, setting it either in thestudio
or in theconfig.*.json
did not change anything but is listed in the terminal on the debug line.Setting it with a wrong value cause an error though.
Any idea?
Thanks in advance!!
-
Hm, there is likely nothing we can do here when you see the correct parameter on the command line.
It seems the dpi currently doesn't work in wkhtmltopdf utility based on this
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2156#issuecomment-299131386
-
Okay I see :/ will have to look for a workarround I guess :(
Thanks anyway!
-
If you are mainly interested in the different size of elements. You can try the adaptation using a css like this
body { transform-origin: 0 0; -webkit-transform-origin: 0 0; transform: scale(0.654545); -webkit-transform: scale(0.654545); }
-
Actually it is not only about the size of the content but display of the content does break because of the DPI difference :/
And using your css unfortunately doesn't change anything about that break :(
as you can see here (first is windows (the "good" one) then ubuntu (the "bad" one))
(blanck space are normals!!)
Also using the 12.3 version as in your extension not the 12.4 stable :/
-
@MI53RE19 just for your information i use
zoom
insteadtransform: scale
,i use the following snippet in my templates and i never had to deal with DPI problems of different OS (at least when using phantom), where
Unix
is a boolean value set in a script that uses the node.jsos
module for the detection of the OS. hopefully it can help you too.<style> {{#if Unix}} html { zoom: 0.5625 } {{else}} {{/if }} </style>
-
@bjrmatos Thanks for the tip! We did found another way that could be used as well, it was to call the
zoom
option fromwkhtmtopdf
, either by setting it in theconfi.*.json
file or by theDocker
command line:docker run -d -p 5488:5488 --restart always -v /path/to/jsreport:/jsreport -e "authentication:enabled=true" -e "authentication:login:password=pass" -e "wkhtmltopdf:zoom=0.78125" jsreport/jsreport:1.7.0-full
The value for
wkhtmltopdf
's zoom that need to be set on linux/mac system to match windows's is0.78125
!Hope this can help people looking into this! And hopefully this will be fixed in
wkhtmltopdf_12.5
!!
-
great! thanks for the info, i will add a note to our
wkhtmltopdf
docs that highlights this workaround. thnks!
-
All the pleasure! :)
-
I'ld like to add something, even if the workarround manage to "fix" the document, both output won't be exactly the same! this is moslty due to header
top
, and footerbottom
margin
(as perwkhtmltopdf
options set in the studio) seems to be impacted by thezoom
factor too! so you'll need to set both manually to have something more similar to originally outputted report onwindows
for an orginal
margin top
of10mm
andbottom
of5mm
I had to set them as44.6mm
and9mm
(not perfectly the same but most likely)maybe it could be nice/useful to add those informations to the your documentation too? (because I'm sure people will ask about it soon or later!! xD)
-
maybe it could be nice/useful to add those informations to the your documentation too? (because I'm sure people will ask about it soon or later!! xD)
sure! thanks for the follow up!