Click or drag to resize
Pdf Library for .NET

PdfTextSection Class

Represents a text that can be added to the header or footer templates of a pdf document.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfSectionElement
    SelectPdf.UniversalPdfTextSection

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class PdfTextSection : PdfSectionElement

The PdfTextSection type exposes the following members.

Constructors
 NameDescription
Public methodPdfTextSection(Single, Single, String) Creates a text object using a default Helvetica 9pt font.
Public methodPdfTextSection(Single, Single, String, PdfFont) Creates a text object that can be added to the header or footer templates of a pdf document.
Public methodPdfTextSection(Single, Single, Single, String, PdfFont) Creates a text object that can be added to the header or footer templates of a pdf document.
Public methodPdfTextSection(Single, Single, Single, Single, String, PdfFont) Creates a text object that can be added to the header or footer templates of a pdf document.
Public methodPdfTextSection(Single, Single, Single, String, PdfFont, PdfColor) Creates a text object that can be added to the header or footer templates of a pdf document.
Public methodPdfTextSection(Single, Single, Single, Single, String, PdfFont, PdfColor) Creates a text object that can be added to the header or footer templates of a pdf document.
Top
Properties
 NameDescription
Public propertyBackColor Gets or sets the element background color.
Public propertyCharacterSpacing Gets or sets the spacing between the text characters.
Public propertyDirection Gets or sets an angle to control the text direction.
Public propertyEmbedFont A flag indicating if the text font will be embedded in the pdf document.
Public propertyFont The text font.
Public propertyForeColor Gets or sets the element foreground color.
Public propertyHeight Gets or sets the element height, in points, in the destination pdf page.
(Inherited from PdfSectionElement)
Public propertyHorizontalAlign Gets or sets the horizontal text alignment.
Public propertyLeading Gets or sets the text leading (the distance between the baselines of consecutive lines of text).
Public propertyRightToLeft Gets or sets a flag indicating if the text is written from right to left.
Public propertyText The text string that will be added to the pdf document header or footer.
Public propertyTextRise Gets or sets the distance to move the text baseline up or down from its default location.
Public propertyTransparency Gets or sets the pdf element transparency.
Public propertyVerticalAlign Gets or sets the vertical text alignment.
Public propertyWidth Gets or sets the element width, in points, in the destination pdf page.
(Inherited from PdfSectionElement)
Public propertyWordSpacing Gets or sets the spacing between the text words.
Public propertyX Gets or sets the element position on the X axis.
(Inherited from PdfSectionElement)
Public propertyY Gets or sets the element position on the Y axis.
(Inherited from PdfSectionElement)
Top
Remarks
The Text property supports the {page_number} and {total_pages} placeholders, which are replaced per page with the current page number and the total number of pages of the generated pdf document.
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.DisplayFooter = true;
PdfFont font = PdfFont.CreateStandardFont(PdfStandardFont.Helvetica, 10);
PdfTextSection text = new PdfTextSection(0, 10,
    "Page {page_number} of {total_pages}", font);
text.HorizontalAlign = PdfTextHorizontalAlign.Center;
text.ForeColor = new PdfColor(0, 0, 0);
converter.Footer.Add(text);
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
doc.Save("out.pdf");
doc.Close();
See Also