B4J Question [ABMaterial] ABMReport Sheet Background

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
When I try to print a page with an ABMReport, the bottom of the sheet- i.e. not occupied by the ABMReport contents - will have the color specified for the background color of the webpage which creates the ABMReport.
If this color is white, everything is OK.
If the color is other than white, this color shows in the report. I have attached here a sample (see Pic1) showing the print preview of a page with a red background (just to highlight the issue).
One workaround is to disable printing background graphics, which takes care of the background color but also ommits other useful colors from the report (see Pic2).

I tried adding this command in Sub BuildPage():
B4X:
page.InjectCSS("@media only print {body{background-color: white}}")
but no changes occured in the printed document.


Is there a way to make the printed report sheet background white, regardless of the webpage background color?
 

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
That would indeed be the way to do it with CSS. Maybe try making a physical .css file and load it with page.AddExtraCSSFile() because InjectCSS works in another way that may not work with such media queries.
Tried this with a separate CSS file in css\custom folder. Red color still showing.
BTW, my CSS knowledge is next to nil - I only copied the @media only print {body{background-color: white}} to this file. Is that enough?
 
Upvote 0

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
I tried it first with page.InjectCss and then with page. AddExtraCSSFile. No success.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…