Correctly print custom CSS shape with transparent borders - html

When I try to print a custom CSS shape (say triangle) as pdf, the transparent areas get printed in black colour.
So what I see is not what I get (printed)!
example: http://cssdeck.com/labs/6jsbafpp
this what I get when printing the example page:
http://i.stack.imgur.com/qzzAm.png
Is there any workarounds to print exactly what I see?

Related

How can I add a color filter to a HTML page?

I would like to have a box (div or canvas?) that filters all the colors that are behind that box.
Like for example I would like to remove all colors except red, or turn everything B&W except yellow.
I tried using a canvas or CSS filters but without luck.

Stripes in background in RDL

Is it possible to add stripes in the textbox in report?
So the result looks like in the picture?
User chooses color for the column in the application
color
This is no built in way of doing this (no fill style) but you could use an image of the stripes as a background image. You would need to create and save images for each colour and style and add them as embedded images in the report.
You can then set the background image of a textbox to the required image.
... or better still use an expression to select the image based on conditions.
=SWITCH(
Fields!ItemCode.Value >10 , "RedStripe",
Fields!ItemCode.Value >50 , "GreenStripe",
True, Nothing
)
Where Redstripe and GreenStripe are the image names you embedded.
You can set the image to repeat etc from the properties panel
Update after OP stated that colour is parameterised.
If the colour is a parameter then we need a slightly different approach.
First you need to create an image with stripes (any colour will do ), and then remove the stripe pixels so that the stipes are now transparent. Save this as a PNG.
I created one quickly whist testing which you can save from here hopefully. You'll just have to move the mouse around in the area below as it's a white on white image! Or switch StackOverflow to the dark theme, then you can right-click and save the image. If not you'll just have to create one yourself.
Image below here.. switch StackOverflow to Dark theme to see it
Image above here..
Now you will need to set the background image to this image but also set the backgroundcolor property to an expression. In this exmaple, I set the background to the value of my parameter.
My parameter is just text and I typed in some hex values in the form #FFFFFF. You will have to work out how to get the value from your color pickers to the report yourself, ask a new question if required.
Here's the report design
and here is the report running using a few sample hex values.

Convert image to true black and white

To print an image on a non-colour printer I need to convert the image to a single colour format. Ive managed to convert to Gray8 using the ColorFilter example here: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters but gray scale is not the same as black and white. When it prints it gets dithered by the printer because the image contains colour channels.
There doesnt seem to be any ColorType or simple way to do this with SkiaSharp. Am I missing something?
We are printing by generating an XPS.. not sure how relevant that is.

Drawing html with transparent background

I'm currently trying to draw an HTML formatted text of a QTextEdit into a QPixmap with a transparent background, to use it as an overlay for another widget.
My first attempt was, to use the QTextDocument of the QTextEdit and use drawContents() to draw it to a QPixmap.
As a second attempt, I passed the HTML to a QStaticText and painted this to my QPixmap, using a QPainter.
Both approaches paint the final text as expected, however, the background of the QPixmap is always grey. Also setting the background-color of the QTextEdit, inside the StyleSheet, to transparent does no change.
Is there any way, that I can make the background transparent?
Apparently, after some more research, I found the solution.
My QPixmap was not transparent at all, even before rendering the text. I came across this blog post, in which the composition mode of the QPainter is set to CompositionMode_Source using a call to setCompositionMode().

Chrome/FF does not show HTML table background colors in printed PDF

How do you set table cell colors in an html table exporting to PDF? I'm dynamically generating content that even has background-color: #ffffff (or red) and displaying it on a web page, but the backgrounds of the cells just come through as white. Basically every PDF writer I try (Chrome's, LisaNet, Firefox's) doesn't render any color.
In PDF is not supported the cell background. we only get in table background. and also padding value and margin value also not supported.