File Formats

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfCompositeField

    Show / Hide Table of Contents

    Class PdfCompositeField

    Inheritance
    System.Object
    PdfGraphicsElement
    PdfAutomaticField
    PdfDynamicField
    PdfMultipleValueField
    PdfCompositeField
    Inherited Members
    PdfMultipleValueField.PerformDraw(PdfGraphics, PointF, Single, Single)
    PdfMultipleValueField.PdfTag
    PdfAutomaticField.Bounds
    PdfAutomaticField.Size
    PdfAutomaticField.Location
    PdfAutomaticField.Font
    PdfAutomaticField.Brush
    PdfAutomaticField.Pen
    PdfAutomaticField.StringFormat
    PdfGraphicsElement.Draw(PdfGraphics)
    PdfGraphicsElement.Draw(PdfGraphics, PointF)
    PdfGraphicsElement.Draw(PdfGraphics, Single, Single)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfCompositeField : PdfMultipleValueField

    Constructors

    PdfCompositeField()

    Declaration
    public PdfCompositeField()

    PdfCompositeField(PdfFont)

    Declaration
    public PdfCompositeField(PdfFont font)
    Parameters
    Type Name Description
    PdfFont font

    PdfCompositeField(PdfFont, PdfBrush)

    Declaration
    public PdfCompositeField(PdfFont font, PdfBrush brush)
    Parameters
    Type Name Description
    PdfFont font
    PdfBrush brush

    PdfCompositeField(PdfFont, PdfBrush, String)

    Declaration
    public PdfCompositeField(PdfFont font, PdfBrush brush, string text)
    Parameters
    Type Name Description
    PdfFont font
    PdfBrush brush
    System.String text

    PdfCompositeField(PdfFont, PdfBrush, String, PdfAutomaticField[])

    Initializes a new instance of the PdfCompositeField class with PdfFont,PdfBrush,text and list of automatic fields.

    Declaration
    public PdfCompositeField(PdfFont font, PdfBrush brush, string text, params PdfAutomaticField[] list)
    Parameters
    Type Name Description
    PdfFont font

    A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.

    PdfBrush brush

    A PdfBrush object that is used to fill the string.

    System.String text

    The wide-character string to be drawn.

    PdfAutomaticField[] list

    The list of PdfAutomaticField objects.

    Examples
    //Create a new document
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage mainPage = document.Pages.Add();
    //Create the PDF font instance.
    PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Times New Roman", 12f));
    //Create the PDF brsh instance.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Green);
    //Create page count field.
    PdfPageCountField pageCount = new PdfPageCountField();
    pageCount.Bounds = new RectangleF(0, 0, 150, 150);
    pageCount.NumberStyle = PdfNumberStyle.Numeric;
    //Create date time field.
    PdfDateTimeField dateField = new PdfDateTimeField();
    dateField.DateFormatString = "MM'/'ddd'/'yyyy";
    //Set value for automatic field.
    PdfAutomaticField[] auto = { pageCount, dateField };
    //Create composite field.
    PdfCompositeField comp = new PdfCompositeField(font, brush, "page {0}, date {1} ", auto);
    comp.Location = new PointF(100, 100);
    comp.Draw(mainPage.Graphics);
    comp.Size = new SizeF(300, 300);
    comp.Font = font;
    //Save and close the document.
    document.Save("Output.pdf");
    document.Close(true);
    'Create new document
    Dim document As PdfDocument = New PdfDocument()
    'Create a new page.
    Dim mainPage As PdfPage = document.Pages.Add()
    'Create the PDF font instance.
    Dim font As PdfTrueTypeFont = New PdfTrueTypeFont(New Font("Times New Roman", 12.0F))
    'Create the PDF font instance.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Green)
    'Create page count field.
    Dim pageCount As PdfPageCountField = New PdfPageCountField()
    pageCount.Bounds = New RectangleF(0, 0, 150, 150)
    pageCount.NumberStyle = PdfNumberStyle.Numeric
    'Create date time field.
    Dim dateField As PdfDateTimeField = New PdfDateTimeField()
    dateField.DateFormatString = "MM'/'ddd'/'yyyy"
    'Set value for automatic field.
    Dim auto As PdfAutomaticField() = {pageCount, dateField }
    'Create composite field.
    Dim comp As PdfCompositeField = New PdfCompositeField(font, brush, "page {0}, date {1} ", auto)
    comp.Location = New PointF(100, 100)
    comp.Draw(mainPage.Graphics)
    comp.Size = New SizeF(300, 300)
    comp.Font = font
    'Save and close the document.
    document.Save("Output.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfPageCountField
    PdfDateTimeField

    PdfCompositeField(PdfFont, String)

    Declaration
    public PdfCompositeField(PdfFont font, string text)
    Parameters
    Type Name Description
    PdfFont font
    System.String text

    PdfCompositeField(PdfFont, String, PdfAutomaticField[])

    Initializes a new instance of the PdfCompositeField class with PdfFont,text and list of automatic fields

    Declaration
    public PdfCompositeField(PdfFont font, string text, params PdfAutomaticField[] list)
    Parameters
    Type Name Description
    PdfFont font

    A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.

    System.String text

    The wide-character string to be drawn.

    PdfAutomaticField[] list

    The list of PdfAutomaticField objects.

    Examples
    //Create a new document
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage mainPage = document.Pages.Add();
    //Create the PDF font instance.
    PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Times New Roman", 12f));
    //Create the PDF brsh instance.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Green);
    //Create page count field.
    PdfPageCountField pageCount = new PdfPageCountField();
    pageCount.Bounds = new RectangleF(0, 0, 150, 150);
    pageCount.NumberStyle = PdfNumberStyle.Numeric;
    //Create date time field.
    PdfDateTimeField dateField = new PdfDateTimeField();
    dateField.DateFormatString = "MM'/'ddd'/'yyyy";
    //Set value for automatic field.
    PdfAutomaticField[] auto = { pageCount, dateField };
    //Create composite field.
    PdfCompositeField comp = new PdfCompositeField(font, "page {0}, date {1} ", auto);
    comp.Brush = brush;
    comp.Location = new PointF(100, 100);
    comp.Draw(mainPage.Graphics);
    comp.Size = new SizeF(300, 300);
    comp.Font = font;
    //Save and close the document.
    document.Save("Output.pdf");
    document.Close(true);
    'Create new document
    Dim document As PdfDocument = New PdfDocument()
    'Create a new page.
    Dim mainPage As PdfPage = document.Pages.Add()
    'Create the PDF font instance.
    Dim font As PdfTrueTypeFont = New PdfTrueTypeFont(New Font("Times New Roman", 12.0F))
    'Create the PDF font instance.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Green)
    'Create page count field.
    Dim pageCount As PdfPageCountField = New PdfPageCountField()
    pageCount.Bounds = New RectangleF(0, 0, 150, 150)
    pageCount.NumberStyle = PdfNumberStyle.Numeric
    'Create date time field.
    Dim dateField As PdfDateTimeField = New PdfDateTimeField()
    dateField.DateFormatString = "MM'/'ddd'/'yyyy"
    'Set value for automatic field.
    Dim auto As PdfAutomaticField() = {pageCount, dateField }
    'Create composite field.
    Dim comp As PdfCompositeField = New PdfCompositeField(font, "page {0}, date {1} ", auto)
    comp.Brush = brush
    comp.Location = New PointF(100, 100)
    comp.Draw(mainPage.Graphics)
    comp.Size = New SizeF(300, 300)
    comp.Font = font
    'Save and close the document.
    document.Save("Output.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfPageCountField
    PdfDateTimeField

    PdfCompositeField(String, PdfAutomaticField[])

    Initializes a new instance of the PdfCompositeField class with text and list of automatic fields

    Declaration
    public PdfCompositeField(string text, params PdfAutomaticField[] list)
    Parameters
    Type Name Description
    System.String text

    The wide-character string to be drawn.

    PdfAutomaticField[] list

    The list of PdfAutomaticField objects.

    Examples
    //Create a new document
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage mainPage = document.Pages.Add();
    //Create the PDF font instance.
    PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Times New Roman", 12f));
    //Create the PDF brsh instance.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Green);
    //Create page count field.
    PdfPageCountField pageCount = new PdfPageCountField();
    pageCount.Bounds = new RectangleF(0, 0, 150, 150);
    pageCount.Font = font;
    pageCount.Brush = brush;
    pageCount.NumberStyle = PdfNumberStyle.Numeric;
    //Create date time field.
    PdfDateTimeField dateField = new PdfDateTimeField();
    dateField.Font = font;
    dateField.DateFormatString = "MM'/'ddd'/'yyyy";
    dateField.Brush = brush;
    //Set value for automatic field.
    PdfAutomaticField[] auto = { pageCount, dateField };
    //Create composite field.
    PdfCompositeField comp = new PdfCompositeField("page {0}, date {1} ", auto);
    comp.Brush = brush;
    comp.Location = new PointF(100, 100);
    comp.Draw(mainPage.Graphics);
    comp.Size = new SizeF(300, 300);
    comp.Font = font;
    //Save and close the document.
    document.Save("Output.pdf");
    document.Close(true);
    'Create new document
    Dim document As PdfDocument = New PdfDocument()
    'Create a new page.
    Dim mainPage As PdfPage = document.Pages.Add()
    'Create the PDF font instance.
    Dim font As PdfTrueTypeFont = New PdfTrueTypeFont(New Font("Times New Roman", 12.0F))
    'Create the PDF font instance.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Green)
    'Create page count field.
    Dim pageCount As PdfPageCountField = New PdfPageCountField()
    pageCount.Bounds = New RectangleF(0, 0, 150, 150)
    pageCount.Font = font
    pageCount.Brush = brush
    pageCount.NumberStyle = PdfNumberStyle.Numeric
    'Create date time field.
    Dim dateField As PdfDateTimeField = New PdfDateTimeField()
    dateField.Font = font
    dateField.DateFormatString = "MM'/'ddd'/'yyyy"
    dateField.Brush = brush
    'Set value for automatic field.
    Dim auto As PdfAutomaticField() = {pageCount, dateField }
    'Create composite field.
    Dim comp As PdfCompositeField = New PdfCompositeField("page {0}, date {1} ", auto)
    comp.Brush = brush
    comp.Location = New PointF(100, 100)
    comp.Draw(mainPage.Graphics)
    comp.Size = New SizeF(300, 300)
    comp.Font = font
    'Save and close the document.
    document.Save("Output.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfPageCountField
    PdfDateTimeField

    Properties

    AutomaticFields

    Gets or sets the automatic fields.

    Declaration
    public PdfAutomaticField[] AutomaticFields { get; set; }
    Property Value
    Type Description
    PdfAutomaticField[]

    The array of automatic fields PdfAutomaticField.

    Examples
    //Create a new document
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage mainPage = document.Pages.Add();
    //Create the PDF font instance.
    PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Times New Roman", 12f));
    //Create the PDF brsh instance.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Green);
    //Create page count field.
    PdfPageCountField pageCount = new PdfPageCountField();
    pageCount.Bounds = new RectangleF(0, 0, 150, 150);
    pageCount.Font = font;
    pageCount.Brush = brush;
    pageCount.NumberStyle = PdfNumberStyle.Numeric;
    //Create date time field.
    PdfDateTimeField dateField = new PdfDateTimeField();
    dateField.Font = font;
    dateField.DateFormatString = "MM'/'ddd'/'yyyy";
    dateField.Brush = brush;
    //Set value for automatic field.
    PdfAutomaticField[] auto = { pageCount, dateField };
    //Create composite field.
    PdfCompositeField comp = new PdfCompositeField();
    comp.Text = "page {0}, date {1}";
    comp.AutomaticFields = auto;
    comp.Brush = brush;
    comp.Location = new PointF(100, 100);
    comp.Draw(mainPage.Graphics);
    comp.Size = new SizeF(300, 300);
    comp.Font = font;
    //Save and close the document.
    document.Save("Output.pdf");
    document.Close(true);
    'Create new document
    Dim document As PdfDocument = New PdfDocument()
    'Create a new page.
    Dim mainPage As PdfPage = document.Pages.Add()
    'Create the PDF font instance.
    Dim font As PdfTrueTypeFont = New PdfTrueTypeFont(New Font("Times New Roman", 12.0F))
    'Create the PDF font instance.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Green)
    'Create page count field.
    Dim pageCount As PdfPageCountField = New PdfPageCountField()
    pageCount.Bounds = New RectangleF(0, 0, 150, 150)
    pageCount.Font = font
    pageCount.Brush = brush
    pageCount.NumberStyle = PdfNumberStyle.Numeric
    'Create date time field.
    Dim dateField As PdfDateTimeField = New PdfDateTimeField()
    dateField.Font = font
    dateField.DateFormatString = "MM'/'ddd'/'yyyy"
    dateField.Brush = brush
    'Set value for automatic field.
    Dim auto As PdfAutomaticField() = {pageCount, dateField }
    'Create composite field.
    Dim comp As PdfCompositeField = New PdfCompositeField()
    comp.Text = "page {0}, date {1}"
    comp.AutomaticFields = auto
    comp.Brush = brush
    comp.Location = New PointF(100, 100)
    comp.Draw(mainPage.Graphics)
    comp.Size = New SizeF(300, 300)
    comp.Font = font
    'Save and close the document.
    document.Save("Output.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfPageCountField
    PdfDateTimeField

    Text

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved