How to get WYSIWYP (print what you see) in a web browser?

73

23

When I print a web page from my browser, I expect to get on paper exactly the content I'm seeing in the browser. To be precise: I expect the browser to render the same page contents the same way, except on a canvas with infinite height, and then decide in a printing-specific way how to distribute the results across physical pages of paper.

However, that is not at all what is happening on many websites. They may print something completely different. I never asked for browsers to do this and I don't want it to happen.

Is there a way to get what I want (other than taking screenshots, painstakingly cutting and pasting them together, and printing the resulting images)? Is there a way to tell a web browser I use (Firefox, Chrome, Safari, IE, or Opera): "print this page as you would render it on an arbitrarily high browser window"?

(PS: see also: Print From Browser Using Screen CSS?)

reinierpost

Posted 2014-11-28T12:39:53.693

Reputation: 1 904

1

possible duplicate of Print From Browser Using Screen CSS?

– Ƭᴇcʜιᴇ007 – 2014-11-28T15:37:32.030

The Chrome extension "Nimbus Screen Capture App" can take an image of the entire web page as it's shown on screen (including the part you can't see without scrolling). I.e. it's as if you've taken a series of screenshots and stitched them together, but it's only one button-click. – A E – 2014-11-28T15:41:54.350

1Print stylesheets are fundamentally useful. When I print this page for example, do I want the question and answers or do I also want the title, the related question and the footer? I'd also appreciate that all comments are visible. Websites are interactive, pieces of paper aren't (most of the time), and those stylesheets can help to focus on the content, saving you ink and paper. – SBoss – 2014-11-28T15:59:34.247

1@SBoss: Not everyone who prints a page will be interested in the same things. I would suggest that a print-friendly page should let a user select what things should be printed, and have the print version match the screen version except--typically--for the controls that show what will print (there should be an option to enable and disable them in printouts, but they should generally appear on screen anyway). – supercat – 2014-11-28T23:54:06.743

1As to the question being a duplicate: I tried stripping out the print stylesheet prior to printing, and it doesn't work, so I don't think the question is a duplicate. – reinierpost – 2014-11-29T22:53:18.583

@supercat Implementing that is going to be pretty hard for most web sites and likely very expensive. Implementing support built-in to the browser is going to be equally hard. Are you volunteering to do it or to pay for it? – Moshe Katz – 2014-12-02T01:31:34.707

@MosheKatz: I would think the Javascript to create checkboxes which, when clicked, add or remove Display: None from various styles should be relatively simple compared with much of the other code, and may in some cases be easier than trying to formulate good automated rules for when various things should appear. Otherwise, I think the "traditional" approach of having a separate "printer-friendly" page as being better than having a style sheet for printing which is totally different from that for browsing. – supercat – 2014-12-02T13:16:04.403

@SBoss: Yes, print stylesheets are useful. That doesn't imply I want to use them. My question is: what to do if I don't. – reinierpost – 2015-09-21T10:20:44.997

@reinierpost you seem to carve out my thoughts about printing in the year of 2016 and put them down in words. There must be a way for the browser to implement the manual process of taking screenshots and by repetition (no thought process needed) print out a series of images. – Anders Lindén – 2016-01-05T16:33:33.400

Another near duplicate: How do I print with the screen stylesheet?

– reinierpost – 2016-07-05T09:14:53.537

Answers

42

Chrome has this feature built into the Developer Tools, but in a very non-obvious location.

  • Open the Developer Tools (Windows: F12 or Ctrl+Shift+I, Mac: Cmd+Opt+I)
  • Click the Customize and control DevTools hamburger menu button and choose More tools > Rendering settings (or Rendering in newer versions).
  • Check the Emulate print media checkbox at the Rendering tab and select the Screen media type.

Quoted mostly from this answer. See below for the difference.

Now when you print, the print out will be exactly what you see. Make sure to keep the developer tools open until you print. Once you close the developer tools the Rendering setting will be reset back to normal.

Note: Inspiration for this answer came from https://superuser.com/a/568847/176146. But the actual text of this answer is from lmeurs' answer. It is almost exactly the same, but we are trying to do the exact opposite of their answer, so instead of setting the override to Print it is set to Screen.

Benjamin

Posted 2014-11-28T12:39:53.693

Reputation: 746

Firefox has obtained this feature in the last year as well. This is obviously superior, but should I un-accept an old answer for that reason? – reinierpost – 2017-11-26T17:07:51.500

@reinierpost it is of course up to you. But the the following might be helpful in your decision - https://meta.stackexchange.com/q/93969/226780

– Benjamin – 2017-11-26T17:39:17.623

Thanks; those answers say I should change, so I will, even though the previously accepted answer does seem to have been the most helpful answer possible at the time it was written. – reinierpost – 2017-11-26T18:55:54.157

Right now, when I try this in Chrome, I only see the option when it's in mobile view mode; I can't get it for the regular desktop view of the page. – reinierpost – 2019-02-26T14:30:39.640

Firefox also has this ability, but in a different way. I suppose a separate answer needs to document that. I'm not sure about other browsers. – reinierpost – 2019-02-26T14:31:17.917

Scroll down to other answers to see how to do it in Firefox (without a plugin). (If you are interested in that... like I was.) :D – codingjeremy – 2019-06-12T22:44:54.410

It does not work for me. My Google Chrome version is 76.0.3809.132. – Diamond – 2019-09-06T21:07:36.197

1Works for me in Chrome 76 with: DevTools > [...] > More tools > Rendering > Emulate CSS media > screen – JeremyDouglass – 2019-09-26T18:24:15.250

It is interesting to me that it only works as long as the developer tools are open. I almost didn't get it to work because of that. – NK1406 – 2019-12-04T02:25:51.773

23

Why do my webpages not print what I see in my browser?

The reason some of your web pages are printing differently is because they have a print stylesheet.


What is a Print Stylesheet?

A print stylesheet formats a web page so when printed, it automatically prints in a user-friendly format. Print stylesheets have been around for a number of years and have been written about a lot. Yet so few websites implement them, meaning we're left with web pages that frustratingly don't properly print on to paper.

It's remarkable that so few websites use print stylesheets as:

  • Print stylesheets enormously improve usability, especially for pages with a lot of content (such as this one!)
  • They're phenomenally quick and easy to set up

Some websites do offer a link to a print-friendly version of the page, but this of course needs to be set up and maintained. It also requires that users notice this link on the screen, and then use it ahead of the regular way they print pages (e.g. by selecting the print button at the top of the screen). Print-friendly versions are however useful when printing a number of web pages at the same time such as an article that spans on to several web pages.

Source Disable Print Stylesheets (CSS) When Printing a Website


How Do I Disable a Print Stylesheet?

I recently needed to get a snapshot of a website exactly as it is shown on my screen. That is, I wanted the background color, I wanted the ads, I wanted the full layout.

One option is to take sequential screenshots as you scroll down the page, then piece them back together in Photoshop. This is time consuming and leaves you with a low-resolution (72dpi) image.

Another way to do this is to Print the page, then "save as" a PDF instead of actually printing. This works quite well for pages that do not define a different layout for printing a page versus viewing the page.

Unfortunately for me, it has become increasingly popular to include a "print" stylesheet on a website, which defines new page styles when a user tries to print the website. This is defined in the header and looks something like this:

I have found only one option that truly addresses my needs: The "Web Developer" add-on / extension developed by Chris Pederick.

With this plugin you can very easily disable ALL styles, Default styles, inline styles, embedded styles, and, you guessed it, print styles!

It is currently available for Firefox and Chrome. I truly hope a Safari extension will come some day, as I primarily use Safari. The only option I have found for Safari is to disable ALL styles - a feature that comes by default with the newest version (5.0.3) of the browser. This is useful during development to see how your site will be viewed on a text-only browser but without the ability to select which styles you're disabling it has limited utility.

Here is an example of disabling print styles with the above extension in Firefox:

enter image description here

Source Print stylesheet - the definitive guide

DavidPostill

Posted 2014-11-28T12:39:53.693

Reputation: 118 938

2Thanks, but this doesn't help for the website I tried it on (trelloprinter.com). I'm amazed how these people have the guts to write that "frustratingly, so many websites don't implement them" when they are a fundamentally broken approach to the problem they're trying to solve. Having separate stylesheets for printing means you failed user interface design 101, or never took it in the first place. – reinierpost – 2014-11-28T13:31:17.667

It doesn't do a thing with Google Maps, either. The Capture and Print extension almost does what I want - all it lacks is a Select all feature. – reinierpost – 2014-11-28T13:35:05.340

1

Perhaps ScreenshotCaptor will do what you need to achieve ... amongst other things it will capture scrolling regions ... but I seem to recall it doesn't play too well with Google Maps.

– DavidPostill – 2014-11-28T13:47:38.183

I've no idea what trelloprinter.com is doing for printing - the "print" button is calling some php script ... – DavidPostill – 2014-11-28T14:17:16.583

Mixed results thus far: ScreenshotCaptor works on Google Maps but doesn't on my trelloprinter.com result ... its author advises us to use a browser plugin, anyway ... I've tried [ScreenGrab (fixed)],(https://addons.mozilla.org/en-US/firefox/addon/screengrab-fix-version/developers) which claims to grab the whole page but doesn't, and FireShot, which once again works on Google Maps but doesn't on trelloprinter.com.

– reinierpost – 2014-11-28T15:09:30.617

1

This won't help much. If you are using IE (I know, save your rocks for later), you can use Greenshot (http://getgreenshot.org/) which has an option to scroll the IE page and take printscreen of it. It will assemble the whole page into 1 screenshot. You can then edit it to your heart's wish.

– Ismael Miguel – 2014-11-28T18:32:36.373

18@reinierpost "Having separate stylesheets for printing means you failed user interface design 101" - That's an awfully wide brush you're painting with there. Are you telling me that if you printed out this page, you'd want to have the Hot Network Questions on the side, or information about chat rooms? Some parts of a page are only useful in an interactive context - why waste space and ink printing them? – Chris Hayes – 2014-11-28T21:09:56.947

4@reinierpost What a ridiculous statement. Suppose a site has a dark background with a light foreground. I won't speak for you, but I personally am happy that the browser has its own print styles as well as many sites, so that I don't waste all my ink when I print. There are plenty of reasons why you want to print the content itself, and not a screenshot. – Brad – 2014-11-28T21:55:15.340

I agree It's fine to print something other than what is shown to the user, but it should be shown to the user prior to doing it, particularly when the results can be so poor. I know I can do Print Preview, but there should be less of a surprise. It would also be nice if the user had more control to make sure the printout is as desired; that basically means you're showing another webpage and offering to print that. Then why not just do it that way! – reinierpost – 2014-11-29T23:12:25.330

Anyway: this method should work, but it didn't when I tried it. – reinierpost – 2014-11-30T21:31:38.173

This is not working, disable print styles makes my page look horrible, no images, huge icons, no formatting. – Herman Toothrot – 2016-12-14T11:57:17.740

@user4050 <shrug> Clearly a badly designed website – DavidPostill – 2016-12-14T12:01:16.263

Be mad all you want. Still doesn't change the basic reality, which is that WYSIWYG support in browsers is notoriously bad. I, for one, looked at using such stylesheets for my own websites, and decided it was rather challenging to do right, and I didn't know that anyone would even really care, so it wasn't worth my efforts (as a webmaster) to worry about this. – TOOGAM – 2017-03-10T09:14:45.967

I'd like to wrap up by saying that this answer asks three followup questions and answers them, expecting this will provide an answer to the original question posed; which (to my surprise) it didn't. – reinierpost – 2017-11-26T19:02:13.583

@reinierpost shrug. You cannot expect browsers to accurately print every website in existence when many of them are badly designed. – DavidPostill – 2017-11-26T19:06:20.117

@DavidPostill Of course you can. They can render them on the screen, after all. – reinierpost – 2020-01-22T10:13:26.873

This worked to print a webpage that had stymied me with other methods. Because I want to print to PDF and retain the text as text and hyperlinks that work plus the images, the screen capture solutions don't work for me. I think we all need to remember that no single solution will cover all situations. – vknowles – 2020-02-03T13:32:40.313

9

A no plug-in solution for Firefox: Open Web Developer Tools, in Default Developer Tools (gear icon) tick "Take a screenshot of the entire page." You only need to do this part once.

Then in Developer Tools, click the camera icon. The entire page will be saved as a .png. From here you can print it, convert to pdf, etc.

Russ

Posted 2014-11-28T12:39:53.693

Reputation: 91

Wow .. that is exactly what I was looking for. Thank you! – reinierpost – 2017-05-09T15:24:32.917

4This feature no longer requires Developer Tools! At the right side of the address bar, select the three dots, click "Take a Screenshot", then select "Save full page". – numbermaniac – 2018-10-30T00:39:21.570

This is amazing, thank you! – codingjeremy – 2019-06-12T22:44:24.170

8

I am using the Chrome extension: Webpage screenshot. With two click's the complete webpage is converted to jpg or pdf. No need to glue the screenshots together yourself any more. This page looks like this: Webpage screenshot demo

Ruut

Posted 2014-11-28T12:39:53.693

Reputation: 341

1This appears to work, too. I was hoping the PDF would give me scalable graphics, but it's just a bitmap. – reinierpost – 2014-12-17T14:21:20.580

1What an awesome way to prove your answer! :) I would have accepted this one as the Answer.. – Vijay Chavda – 2017-06-22T15:46:35.870

Amazing extension! It seems to create pdf in landscape mode. Is it possible to create pdf in portrait mode? @reinierpost – user674669 – 2018-12-05T19:17:42.453

3

I was also facing the similar problem. Currently I'm using Print Friendly and PDF Extenstion for Chrome.

Best feature is I can manually delete the items which I don't want in my Print/PDF.

Nikhil

Posted 2014-11-28T12:39:53.693

Reputation: 31

Interesting ... in Firefox, I use the PrintWhatYouLike bookmarklet for this purpose. It works well, but it doesn't handle "infinite" scrolling (e.q. Quora) - neither does this extension.

– reinierpost – 2017-02-24T10:09:48.150

Nice tip - thanks! By default it keeps the text as text, links as links and shows images as full size. A 6 page travel article with several large pictures is now an immaculate PDF at 500kb. – Mike Honey – 2017-04-27T12:15:11.543

1

(At the risk of turning this into a set of Software Recommendations answers, but so far, install and use browser extension X seems to be the only kind of answer that actually works:)

Lately I've been using the Open Screenshot Chrome extension for this purpose, and I'm very happy with it. It had no problems with a long Quora page.

Update (November, 2017): this is no longer the best option: Firefox and Chrome now support taking full-page screenshots in their Developer Tools.

reinierpost

Posted 2014-11-28T12:39:53.693

Reputation: 1 904

I think you meant to say "1-click webpage screenshot" instead of "Open Screenshot". Right? – user674669 – 2018-12-05T19:27:09.833

No. Apparently, they renamed themselves. I'm not sure what to do with this answer. – reinierpost – 2018-12-06T10:02:33.827

1

Here's another one called OpenScreenShoot. I love it because it's Open source, available at GitHub, and it worked for me for a very long webpage on which, other alternatives like WebpageScreenShot failed.

Vijay Chavda

Posted 2014-11-28T12:39:53.693

Reputation: 121

I think you meant to say "1-click webpage screenshot" instead of "Open Screenshot". Right? – user674669 – 2018-12-05T19:35:37.453

1

Today, this can be done in Firefox (I'm using 65.0.2 right now) as follows:

  1. Press F12. The Developer Tools pane will show up.
  2. Near the right upper hand corner, there is a camera icon. To take a screenshot of the entire page, click on it.

In Settings (to access them, click the three dots to the right of the camera icon), you can slightly customize its behavior; by default, it will save the screenshot to your Firefox downloads folder.

If the camera icon is missing, you first need to enable it in Settings.

The screenshot tool in Firefox Developer Tools

reinierpost

Posted 2014-11-28T12:39:53.693

Reputation: 1 904