zengsn / html5slides

用于制作移动课件的HTML5模板
0 stars 0 forks source link

The slides are not printable #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you want to produce a PDF or print the slides it is not possible, it only 
prints the slide page that you are currently viewing.

Original issue reported on code.google.com by fes...@gmail.com on 22 Nov 2011 at 12:34

GoogleCodeExporter commented 9 years ago
Same problem here... there is no "print" css... Problem is that javascript 
import style with no "media=screen"... maybe you can change it ?

Original comment by Metal3d on 8 Dec 2011 at 2:19

GoogleCodeExporter commented 9 years ago
You can add this at end of "head":

  <script type="text/javascript">
    window.addEventListener('load', function(){
        var link = document.getElementsByTagName('link');
        link[link.length-1].setAttribute ("media","screen");
    });
  </script>

That change the media for style and let you print the slide

Original comment by Metal3d on 8 Dec 2011 at 2:29

GoogleCodeExporter commented 9 years ago
My styles was missing:

     <style media="print">
         @page {
            size: A4 landscape;
             @top-right {
                content: "Page " counter(page);
             }
         }
          article {
            page-break-after: always;
            margin: auto;
          }
          article.next, article.past {
            display: block;    
          }
          body {
              display: block !important;
              font-family: 'Open Sans', Arial, sans-serif;
              font-size: 1.5em;
          }
      </style>
      <script type="text/javascript">
        window.addEventListener('load', function(){
            var link = document.getElementsByTagName('link');
            link[link.length-1].setAttribute ("media","screen");
        });

Without style for "print", and having only "screen" styles, print is not 
available :) So, my stcript add "media=screen" to default CSS and set some 
settings for "print"

Original comment by Metal3d on 11 Dec 2011 at 5:50

GoogleCodeExporter commented 9 years ago
Thank you very much for this.  It was very helpful.

Tom

Original comment by tomv.hca...@gmail.com on 28 Jan 2012 at 4:57