Besides using one of the default formats you can specify any size you want in the unit you specify.
For example:
// Document of 210mm wide and 297mm high
new jsPDF('p', 'mm', [297, 210]);
// Document of 297mm wide and 210mm high
new jsPDF('l', 'mm', [297, 210]);
// Document of 5 inch width and 3 inch high
new jsPDF('l', 'in', [3, 5]);
The 3rd parameter of the constructor can take an array of the dimensions. However they do not correspond to width and height, instead they are long side and short side (or flipped around).
Your 1st parameter (landscape
or portrait
) determines what becomes the width and the height.
In the sourcecode on GitHub you can see the supported units (relative proportions to pt
), and you can also see the default page formats (with their sizes in pt
).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…