js print to PDF只打印第一张幻灯片

reveal.js print to pdf only prints the first slide?

本文关键字:一张 幻灯片 to print PDF 打印 js      更新时间:2023-09-26

我正在尝试使用repo自述文件中记录的rev .js的pdf导出选项。

我有以下问题:

  • 我没有看到布局选项(横向vs纵向)在我的铬打印窗口
  • 打印只打印第一张幻灯片

不知道我做错了什么,也不知道如何排除故障。我在这个示例文件上使用Github上的最新版本的reveal.js css等(sha: 131c00689a4c7a18e5c991fc8102347e4594b5d4)。

我在Ubuntu 14.04上使用Google-chrome版本34.0.1847.132

  1. 移除
    <link rel="stylesheet" media="print" href="reveal.js/css/print/pdf.css" />
    
  2. 添加
    <!-- If the query includes 'print-pdf', include the PDF print sheet -->
    <script>
      if( window.location.search.match( /print-pdf/gi ) ) {
        var link = document.createElement( 'link' );
        link.rel = 'stylesheet';
        link.type = 'text/css';
        link.href = 'reveal.js/css/print/pdf.css';
        document.getElementsByTagName( 'head' )[0].appendChild( link );
      }
    </script>
    
  3. ?print-pdf添加到URL的末尾,例如将.../index.html#改为.../index.html?print-pdf#

我用幻灯片做了一个演示,并以HTML格式导出,但对我来说,William Zhanf解决方案根本不起作用。我把所有的幻灯片都重叠了。我是这样解决的:

  1. 从这里下载pdf.css并将其与html文件放在同一个文件夹中。
  2. </body>标签前粘贴William Zhanf片段(更改了css文件的路径):
<script>
  if( window.location.search.match( /print-pdf/gi ) ) {
    var link = document.createElement( 'link' );
    link.rel = 'stylesheet';
    link.type = 'text/css';
    link.href = 'pdf.css'; // Notice: I changed the path
    document.getElementsByTagName( 'head' )[0].appendChild( link );
  }
</script>
  • 然后按照相同的指令:将?print-pdf添加到URL的末尾并从Chrome打印为PDF。