Main background is not transparent in some cases
-
Hi,
I have a strange behavior when I merge 2 templates: the main template body is not transparent in some specific cases.
After many hours I found that the behavior depends of 2 things:
- The margin top
- If the main template is on 1 or 2 (or more) pages
Here an example: https://playground.jsreport.net/w/anon/knUoNpGw
If you play with this example, and change the margin top of main template to 4cm, the main body background become transparent. If you change back to 5cm then the background is again white (not transparent).
Also, in main template if you keep margin top to 5cm and then you uncomment the second
div
, then the main template will be printed on 2 pages and in this case the background become transparent...Any suggestion ?
Thanks.
-
Thank you for the examples and verbose problem description.
I've pushed the fix to the master that should resolve this
https://github.com/jsreport/jsreport/commit/25374beb2628340b20cc8d0207bec89103a059a6Some low level details:
The problem is that chrome puts to the pdf a big white rectangle at the beginning.
If we want the merge to work, we need to remove this rectangle so the header can be visible.
To determine if we want to remove this rectangle, we were using its size.
There was a calculation checking if its size was bigger than the page, so it is likely the one we should remove.
This doesn't work in your example because the rectangle is smaller because of the margins.
I've changed the algorithm determining the rectangle is chrome default background and hope this will work better.