Mobile app version of vmapp.org
Login or Join
Jessie594

: Print friendly version best practice I am currently recoding a website from tables to modern html/css and have several 100 pages to go over. The problem is, each page has its own print version

@Jessie594

Posted in: #BestPractices #Css #Print

I am currently recoding a website from tables to modern html/css and have several 100 pages to go over.

The problem is, each page has its own print version in another file, also with tables.

Would it be acceptable to apply a print stylesheet instead of a different file for print?

Also, when I click on print button on this page the new version opens up and somehow the print promt starts.

How is this done exactly?

Is there any advantage of using a different version of a page (in this case different .html file) instead of css for the same file?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Jessie594

2 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

Definitely using a print-only stylesheet would be your best way to go. Once you have that established and working as you want, you can simply add an anchor tag to each page that will then open the print dialog, with something like <a href="javascript:window.print();" title="Click here to print this page">Print this Page</a>.

By going this route you decrease future maintenance, and (slightly) increase printing performance.

10% popularity Vote Up Vote Down


 

@Speyer207

There is many reasons why you should opt to use to a print.css and here's just a few reasons.


new pages have a print option with no further intervention.
Google can easily see that you have a print css (No worries about duplicate content.)
no need to edit any markup.


Now... Your vague on using a different HTML file since this could mean 2 things, you have a different style sheet assigned to pageB or your actually editing elements out of the page. Either way your duplicating content unnecessary - granted we have things like canonical links which helps prevent this but it should be just a guess of pressing the print bottom and BAM.

Also a different page that prompts for print would need to use JavaScript which may not work because JS is not enabled, you'd need to use something like window.onload = function() { window.print(); }

Personally I'd opt to use print.css if you opt to use pageB method using a style sheet would be pointless and editing elements of the page would be tiresome, you want the method that your able to make global changes quickly - CSS Print enables this.

Simply use stuff like:

header, footer, a, img{display:none;}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme