PdfTemplateVerticalAlignment
6 Jul 20261 minute to read
Public enum to define vertical alignment options.
```typescript
// Create new document
let document: PdfDocument = new PdfDocument();
// Create a header template
let headerTemplate: PdfPageTemplateElement = new PdfPageTemplateElement({width: 595, height: 50});
// Draw content on header
headerTemplate.graphics.drawString(‘Header’, font, {x: 10, y: 10, width: 575, height: 30}, brush);
// Assign to document template with vertical alignment
document.template.left = {template: headerTemplate, alignment: PdfTemplateVerticalAlignment.top};
// Save the document
document.save(‘output.pdf’);
// Destroy the document
document.destroy();
-
bottom- Aligns the content to the bottom -
middle- Centers the content vertically -
none- No vertical alignment is applied -
top- Aligns the content to the top