print html table in colors

i want to print an html table with all original colors using HTMLViewer1.Print()
how could i do that?

and what DOES it print? if not in the original colors?

That is what HTML is all about, embedding the format information (colors, fonts etc) in the document

if you want to print this page using Ctrl + P in your browser… you will print all information, but without colors… just black and white. the same problem occurs with HTMLViewer

well in your browser you must click the “print backgrounds” and then it prints just fine… I believe it is an “ink saving” feature, but regardless, it is a feature

ok. but… how could i print background if i am using HTMLViewer?

seems HTMLViewer doesn’t give you those options… unlike a “real” browser

If you created the table, it is fairly easy to use the printer graphics object to print everything, like you would from a desktop app. Of course, it is a bit more involved than using the ready made routine.

@Michel Bujardet … i dont know how to do that. could you give me a little example?

Basically, using OpenPrinterDialog you create a graphics object into which you will draw all the elements you want on the page.

Then you can for instance use fillRect to draw the background color, perhaps DrawPicture if you have a background picture, then use DrawLine to draw the frame and cells of the table if needed, and finally DrawString to draw the content.

Since you probably know the proportions of your table, it is pretty easy to make that correspond to the 72 default characters per inch of the printer object with an elementary calculus.

maybe an alternative idea could be show the html code using an external browser like chrome, firefox etc. how could i do this?

Write it to a temporary file and use ShowUrl? That will launch the browser and show the file (note that you have to pass the local URL of the file as parameter).
Other than that, you might also write it to a temporary file and use Folderitem.Launch: