Debug Drupal print view

Let’s say you’ve added the Lexicon module and now your page, when printed, includes lots of URLs in parentheses following links in your copy.

Quite annoying really.

How do you find out what classes might be associated with these links so that you can hide them using the print.css file?

The answer has nothing to do with Drupal.

You need to force the browser, let’s say Chrome, into print emulation mode.

Open Developer Tools.

Press Control-Shift-P. Enter rendering and select Show rendering.

Change Emulate CSS media to print.

In the particular case for the Lexicon module, the solution was to add

a.lexicon-term::after {
        display : none;
}

to the print.css file in the theme folder.

 

References

https://developers.google.com/web/tools/chrome-devtools/css/print-preview