1

When printing an HTML document the bgcolor of a table cell is ignored.

What else is ignored when one tries to print documents?

I'm trying to make a particular website look a certain way when printed out but am having some difficulty doing so not knowing what attributes printers use and which ones they ignore.

Thanks!

Community
  • 1
  • 1
neubert
  • 15,947
  • 24
  • 120
  • 212
  • 1
    Note that you can always make explicit style rules by putting CSS inside a `@media print { ... }` block. Also it's not the *printer* that does the work here; it's what the browser sends to be printed that matters. – Pointy Aug 13 '13 at 22:18

2 Answers2

2

The link you're referring to is about browser-specific print handling. Check out the each supported browser's printing properties for more info there.

Regularly, though, WYSIWYG when it comes to printing an HTML page.

You could specify a specific CSS file for printing by adding the following tag to your <head> tag:

<link rel="stylesheet" href="print.css" type="text/css" media="print" />

Where print.css is the path to your CSS file.

Addition:
Though you can't override the Browser-preferences, there's nothing you can do to print your BG in non-allowing browsers. Check the printing preferences for those options.
My best idea is to export your web-page to PDF and print that. See web2pdfconvert, for example of such a service. You could also install a plugin on your server side that does exactly the same thing, and the send it your HTML via AJAX.

Another Addition: Take a look at jsPDF which is completely client side and thus simpler. You can use it to convert the page to pdf and than print it as it is.

EZLearner
  • 1,614
  • 16
  • 25
1

Things that may be ignored are completely dependent upon the browser in question and the print settings for that browser.

For example, in Chrome you can turn off headers/footers and backgrounds. In Firefox you have control over backgrounds. In IE you have some refined control over frames, linked documents and optionally printing a table of links.

Your best bet is to simply provide a style sheet for media="print" and define how you want the page to look.

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • 1
    Things also depend on the physical printer. You can’t make a black and white printer produce colors. Moreover, handling of units tends to vary; `10pt` on screen may differ from `10pt` in print. – Jukka K. Korpela Aug 14 '13 at 07:18