NodeJS和PDFKit:如何使第一页横向显示?

12

所以,我有一个文档:

var doc = new PDFDocument;

文档告诉我PDFKit文档的第一页会自动添加,不需要手动添加。但是如何使其横向?

这个。

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

有效,但会添加另一页。

2个回答

26

所以很明显:

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

这个答案不起作用。 - Htut

1

您可以禁用autoFirstPage

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接