Pdf | |
The PdfTemplate type exposes the following members.
| Name | Description | |
|---|---|---|
| Anchoring | Gets or sets the template anchoring settings inside the pdf page. | |
| Background | Controls whether the template is rendered behind the page main content. The default is false. | |
| Bounds | Gets or sets the template bounds rectangle. Has no effect for the default header / footer. | |
| ClientRectangle |
Gets the drawable area of the canvas. The page margins (and, for a page, the document header
and footer) are excluded.
(Inherited from PdfCanvas) | |
| DisplayOnEvenPages | Controls the visibility of the template on the even numbered pages of the pdf document. | |
| DisplayOnFirstPage | Controls the visibility of the template on the first page of the pdf document. This property has priority over DisplayOnOddPages. The default value is true. | |
| DisplayOnOddPages | Controls the visibility of the template on the odd numbered pages of the pdf document. | |
| Docking | Gets or sets the template docking style inside the pdf page. | |
| FirstPageNumber | Controls the page number for the first page being rendered. The default is 1. | |
| Foreground | Controls whether the template is rendered in front of the page main content. The default is true. | |
| Height | Gets or sets the height for a custom template. Has no effect for the default header / footer. | |
| LFN | Gets or sets the path of the diagnostic log file written while the html content added to this template is rendered. An html element that has a log file of its own keeps it. When unset, a template obtained through the document's Header, Footer or AddTemplate(Single, Single) uses the document's log file. When none is set, no log is written. | |
| TotalPagesOffset | Controls the total number of pages offset in the pdf document. | |
| Width | Gets or sets the width for a custom template. Has no effect for the default header / footer. |
| Name | Description | |
|---|---|---|
| Add |
Adds a pdf element to the template.
(Overrides PdfCanvasAdd(PdfPageElement)) | |
| AddAsync(PdfPageElement) |
Adds a pdf page element to the canvas without waiting for it to be rendered.
(Inherited from PdfCanvas) | |
| AddAsync(PdfPageElement, CancellationToken) |
Adds a pdf page element to the canvas without waiting for it to be rendered, stopping when
the specified token is cancelled.
(Inherited from PdfCanvas) | |
| MeasureString |
Measures the size of the specified string when rendered with the specified font.
(Inherited from PdfCanvas) |
PdfDocument doc = new PdfDocument(); doc.AddPage(); PdfTemplate header = doc.Templates.Add(doc.Pages[0].PageSize.Width, 40); header.Add(new PdfTextElement(0, 10, "CONFIDENTIAL", PdfFont.CreateStandardFont(PdfStandardFont.HelveticaBold, 12), new PdfColor(0, 0, 0))); doc.Templates.Header = header; doc.Save("with-header.pdf");