<< Click to Display Table of Contents >> Page dimensions, orientation and margins |
dd TDocDefinition
dd.AddGlobalProperty('pageSize', '"A5"')
dd.AddGlobalProperty('pageOrientation', '"landscape"')
! or shortcut
! dd.PageSettings('A5', 'landscape')
dd.AddGlobalProperty('pageMargins', '[ 40, 60, 40, 60 ]')
[=== compare with pdfMake:
var docDefinition = {
// a string or { width: number, height: number }
pageSize: 'A5',
// by default we use portrait, you can change it to landscape if you wish
pageOrientation: 'landscape',
// [left, top, right, bottom] or [horizontal, vertical] or just a number for equal margins
pageMargins: [ 40, 60, 40, 60 ],
};
===]
If you set pageSize to a string, you can use one of the following values:
'4A0', '2A0', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10',
'B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10',
'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'C10',
'RA0', 'RA1', 'RA2', 'RA3', 'RA4',
'SRA0', 'SRA1', 'SRA2', 'SRA3', 'SRA4',
'EXECUTIVE', 'FOLIO', 'LEGAL', 'LETTER', 'TABLOID'
To change page orientation within a document, add a page break with the new page orientation.
dd.AddGlobalProperty('pageOrientation', '"portrait"')
dd.AddText('Text on Portrait')
dd.AddText('Text on Landscape', '"pageOrientation": "landscape", "pageBreak": "before"')
dd.AddText('Text on Landscape 2', '"pageOrientation": "portrait", "pageBreak": "after"')
dd.AddText('Text on Portrait 2')
[=== compare with pdfMake:
{
pageOrientation: 'portrait',
content: [
{text: 'Text on Portrait'},
{text: 'Text on Landscape', pageOrientation: 'landscape', pageBreak: 'before'},
{text: 'Text on Landscape 2', pageOrientation: 'portrait', pageBreak: 'after'},
{text: 'Text on Portrait 2'},
]
}
===]