Blog About Contact

Getting Chrome to Print with background colors enabled

Published Tue, 7 Aug 2012 • 6 comments

Chrome has a nice feature which allows it to "Print to PDF" without any native PDF print driver installed. This is really handy for taking "screenshots" of web pages to a portable format like PDF, however one thing which is frustrating is that background colors are forcibly removed for printing, even when printing to PDF.

This makes some sense when printing to a piece of paper, but is often not what you want for printing to PDF. Google has not provided an option to switch this behavior off, however there is a way around it.

  1. Right click somewhere in the page
  2. Click "Inspect Element"
  3. Find the top level "<body ... >" tag in the HTML document
  4. Double click and add this attribute:

style="-webkit-print-color-adjust:exact;"

e.g. the full tag might be:

Now when you print, background colors will not be modified.


About the Author

Richard Nichols is an Australian software engineer with a passion for making things.

Follow him on twitter or subscribe by RSS or email.

You might also enjoy reading -


Discuss / Comment

There are 6 comments.

Add a comment

  • {{e.error}}

Thanks for your comment!/

Required.
Valid email address required.
Required.
Posting message, please wait...