Recent Topics

1 Feb 11, 2019 07:37    

Not sure if this is of any use to other people, but a few years ago I made a skin that would just show a post content, well just the page that shows, so [pagebreaks] would have to be lacking.

You can go to my site https://calstock.org.uk and click on a post or page and you will see a Printer Friendly Page link.

I don't print much but it has been useful, and I have just ensured it's working on v6.10.6

It's in two parts.
a) the skin folder and
b) code in the [/skins/your_skin/_single.main.php] and [/skins/your_skin/_page.main.php] for example.

Here's the code for the pages which I put in the metatag section right after the post. You may have fiddle to get it how you want it. Below it has been inserted before an edit link I already had at the bottom of each post.

<?php
echo'<a href="https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?tempskin=print&amp;disp='.$disp.'" target="_blank"><img class="print_icon" src="../../rsc/icons/print_icon.png" alt="print" title="print" /> &nbsp; Printer Friendly Layout &nbsp;</a> &nbsp;&nbsp;';

$Item->edit_link( array( // Link to backoffice for editing
'before' => '',
'after' => '',
'text' => '#',
'title' => '#',
'class' => 'edit',
'save_context' => true,
) );
?>

Have attached the skin which has two css files that will want to look at.

May be of some use to someone

Attachments:

2 Feb 11, 2019 14:13

You can also make a printer version of your CSS which will automatically apply (and hide unwanted items) when printing.

3 Feb 11, 2019 14:43

Yes I think I'll try that for the exercise too then.
Thanks for the reminder that i could {display:none}, somehow my method grabbed my interest, probably as I learnt a little about skins

5 Feb 08, 2020 20:55

I finally needed to do this with a Manual type collection because it's based on automotive repair and not everyone can bring their computer to their vehicle. I've printed many pages from my repair software so I could bring them to the vehicle. I now have a rugged tablet that's daylight viewable so I don't have to print pages. It's also my scan tool.

Surprisingly easy. Tried a print preview and there was quite a bit that needed to be hidden. I tried a print.css file and linking it in _header_inc.php but it didn't do anything so I'm just using collection>settings>advanced>style with @media print but I'll probably put it in my style.css instead. Something really odd. As widespread as bootstrap is, you'd think there'd be lots of articles and even example print.css files out there. Nope.
This is what I used although different people will be using different widgets so it would need some tweaking for Manuals other than mine but it gives you a general idea. Also, I'm using bevo7 so some of the classes will be different.

@media print {
body.evo_toolbar_visible div#skin_wrapper .evo_container__site_header, body.evo_toolbar_visible div#skin_wrapper .sitewide_header, nav, #evo_container__sidebar, #evo_container__sidebar_2, #evo_container__sidebar_single, .center, .evo_container__site_footer, .widget_core_item_info_line, #header.site_skins {
    display: none;
    }
}

@media print 
{
  a[href]:after { content: none !important; }
  img[src]:after { content: none !important; }
}

That bottom part is for hiding the url of every single link and image on the page. I don't know where that was coming from but it looked bad. Doesn't remove the one at the top of the page but I wasn't worried about that one. You can get rid of that too using tighter margins.

I wanted a logo to get printed and had one in the header but it was too big and took up vertical space so I added a logo to the breadcrumb widget item which I did not hide for print. That worked out well.

Results; (try doing a print preview on a b2evo Manual/Docs page - omg - 1 page turns into 9)

6 Feb 09, 2020 20:43

Nice to see your efforts.
All the best


Form is loading...

CMS + user community – This forum is powered by b2evolution CMS, a complete engine for your website.