【问题标题】:NodeJS and PDFKit: how to make first page to be landscape?NodeJS 和 PDFKit:如何将第一页设为横向?
【发布时间】:2014-02-01 03:32:50
【问题描述】:

所以,我有一份文件:

var doc = new PDFDocument;

文档告诉我PDFKit 文档的第一页是自动为您添加的,因此无需手动添加。但是我怎样才能把它变成风景呢?

这个

doc.addPage({
    size: 'LEGAL',
    layout: 'landscape'
});

有效,但添加了另一个页面。

【问题讨论】:

    标签: node.js node-pdfkit


    【解决方案1】:

    所以很明显:

    var doc = new PDFDocument(
            {
                layout : 'landscape'
            }
        );
    

    【讨论】:

      【解决方案2】:

      您可以禁用 autoFirstPage

      const doc = new PDFDocument({ autoFirstPage: false });
      doc.addPage({
          size: 'LEGAL',
          layout: 'landscape'
      });
      
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-12-14
        • 1970-01-01
        相关资源
        最近更新 更多