How to make a page printable? Using latest v of c5

Permalink
HI,
I have a page with song lyrics. I'd like to have a button where perople can print out the lyrics directly.

I'd like to enable printing only for that content block.
I don't need nav or sidebar contents printed. The only thing that would be nice is having the site URL printed at the bottom by default.

I could of course resort to having a print button that opens a pdf in a new browser window, but I'd like to avoid this if possible.

Any ideas how I can manage this?
I looked for add ons but "print page" or "print block" or only "print" don't pull any relevant add os or don't pull any add ons at all.

All help with this will be greatly appreciated!

rritz
 
JohntheFish replied on at Permalink Reply
JohntheFish
This is usually done in CSS. You have an "@media print" section in the theme or styles for the page that hides anything you don't want shown, gets rid of sidebars, headers, footers, navigation, unwanted images, sets background to white and text to black etc.

Basic overview athttps://www.w3schools.com/css/css3_mediaqueries.asp...
c5dragon replied on at Permalink Reply
c5dragon
And some simple code will give you the button and command to print:
https://www.concrete5.org/community/forums/5-7-discussion/print-butt...
rritz replied on at Permalink Reply
rritz
Thank you both!
I'll look into this. Feeliing a bit overwhelmed with c5.8, css is organised very different from c5.6
can't really find my way round yet.
rritz replied on at Permalink Reply
rritz
Hi JohntheFish, how do I get rid of sidebars, headers, footers, menus, etc. using css? It beats me
JohntheFish replied on at Permalink Reply
JohntheFish
Something like
@media print {
    /* this selector would need to be adjusted to match your theme */
     .sidebar { 
          display:none
    }
}

There are plenty of references if you google css @media print. This one looks like a good introhttps://www.smashingmagazine.com/2011/11/how-to-set-up-a-print-style...

You will need to insert css selectors for any area you want to hide from the printed version.

There are probably some standard print stylesheets available that will do things like eliminate all backgrounds and make it black text on white.
rritz replied on at Permalink Reply
rritz
Thank you for replying so promptly!
Alas, this is exactly what I am doing, but it doesn't work.
All the page parts are still shown in print preview despite my display:none settings.
I was hoping this was old deprecated method and someone would tell me I need to use a different method.

The background and font color settings work alright, but the non-print areas do not obey my commands ... ok I#ll keep on trying
JohntheFish replied on at Permalink Reply
JohntheFish
A couple of possibilities:
- You have the wrong selectors
- You have the right selectors, but other rules are stronger. For example, a theme contains a @media all part that provides a background property with !important.

A look at the developer console on the print preview may provide some clues.
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
I have an addon that I developed for 5.7 that does pretty much this very thing. It never did get approved for the marketplace. You can take a look at a live demo here:

http://c57.pinecreativelabs.com/ez-series/ez-print...

EZ Print allows you to create a printable block.
Let me know if you are interested.
rritz replied on at Permalink Reply
rritz
sorry for late reply ... yes I'm interested! :-)

Just why was it not approved for marketplace?