menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfAutomaticField - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfAutomaticField

    Represents a fields which is calculated before the document saves.

    Inheritance
    System.Object
    PdfGraphicsElement
    PdfAutomaticField
    PdfDynamicField
    PdfStaticField
    Inherited Members
    PdfGraphicsElement.Draw(PdfGraphics)
    PdfGraphicsElement.Draw(PdfGraphics, PointF)
    PdfGraphicsElement.Draw(PdfGraphics, Single, Single)
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public abstract class PdfAutomaticField : PdfGraphicsElement
    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)

    Constructors

    PdfAutomaticField()

    Initializes a new instance of the PdfAutomaticField class.

    Declaration
    protected PdfAutomaticField()

    PdfAutomaticField(PdfFont)

    Initializes a new instance of the PdfAutomaticField class with PdfFont

    Declaration
    protected PdfAutomaticField(PdfFont font)
    Parameters
    Type Name Description
    PdfFont font

    The PdfFont represents the format of the text.

    PdfAutomaticField(PdfFont, RectangleF)

    Initializes a new instance of the PdfAutomaticField class with PdfFont and bounds.

    Declaration
    protected PdfAutomaticField(PdfFont font, RectangleF bounds)
    Parameters
    Type Name Description
    PdfFont font

    The PdfFont represents the format of the text.

    RectangleF bounds

    The bounds.

    PdfAutomaticField(PdfFont, PdfBrush)

    Initializes a new instance of the PdfAutomaticField class with PdfFont and PdfBrush.

    Declaration
    protected PdfAutomaticField(PdfFont font, PdfBrush brush)
    Parameters
    Type Name Description
    PdfFont font

    The PdfFont represents the format of the text.

    PdfBrush brush

    The PdfBrush provides color and texture to the text.

    Properties

    Bounds

    Gets or sets the bounds of the field.

    Declaration
    public RectangleF Bounds { get; set; }
    Property Value
    Type Description
    RectangleF

    The bounds value.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set location and size for the automatic field.
    field.Bounds = new RectangleF(50, 50, 100, 100);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set location and size for the automatic field.
    field.Bounds = New RectangleF(50, 50, 100, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Brush

    Gets or sets the PdfBrush of the field

    Declaration
    public PdfBrush Brush { get; set; }
    Property Value
    Type Description
    PdfBrush

    The PdfBrush provides color and texture to the text.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Font

    Gets or sets the PdfFont of the field.

    Declaration
    public PdfFont Font { get; set; }
    Property Value
    Type Description
    PdfFont

    The PdfFont represents the format of the text.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Location

    Gets or sets the location of the field.

    Declaration
    public PointF Location { get; set; }
    Property Value
    Type Description
    PointF

    The location.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Pen

    Gets or sets the PdfPen of the field.

    Declaration
    public PdfPen Pen { get; set; }
    Property Value
    Type Description
    PdfPen

    The PdfPen that determines the color, width, and style of the text.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Size

    Gets or sets the size of the field.

    Declaration
    public SizeF Size { get; set; }
    Property Value
    Type Description
    SizeF

    The size of the field.

    Examples
    //Create a new document.
    PdfDocument document = new PdfDocument();
    //Create new instance of PDF font.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
    //Create new instance of PDF brush.
    PdfSolidBrush brush = new PdfSolidBrush(Color.Blue);
    //Creates page number field.
    PdfPageNumberField pageNumber = new PdfPageNumberField(font);
    //Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric;
    //Create automatic field.
    PdfAutomaticField field = pageNumber;
    //Set font for automatic field.
    field.Font = font;
    //Set brush for automatic field.
    field.Brush = brush;
    //Set size for automatic field.
    field.Size = new SizeF(100, 50);
    //Set location for automatic field.
    field.Location = new PointF(50, 50);
    for (int i = 0; i != 2; i++)
    {
    PdfPage page = document.Pages.Add();
    field.Draw(page.Graphics);
    }
    //Save and close the document.
    document.Save("AutomaticField.pdf");
    document.Close(true);
    'Create a new document.
    Dim document As PdfDocument = New PdfDocument()
    'Create new instance of PDF font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
    'Create new instance of PDF brush.
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Blue)
    'Creates page number field.
    Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
    'Set number style for page number field.
    pageNumber.NumberStyle = PdfNumberStyle.Numeric
    'Create automatic field.
    Dim field As PdfAutomaticField = pageNumber
    'Set font for automatic field.
    field.Font = font
    'Set brush for automatic field.
    field.Brush = brush
    'Set size for automatic field.
    field.Size = New SizeF(100, 50)
    'Set location for automatic field.
    field.Location = New PointF(50, 50)
    For i As Integer = 0 To 1
    Dim page As PdfPage = document.Pages.Add()
    field.Draw(page.Graphics)
    Next i
    'Save and close the document.
    document.Save("AutomaticField.pdf")
    document.Close(True)
    See Also
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    StringFormat

    Gets or sets the PdfStringFormat of the field.

    Declaration
    public PdfStringFormat StringFormat { get; set; }
    Property Value
    Type Description
    PdfStringFormat

    The PdfStringFormat determines text layout information on PDF

    See Also

    PdfGraphicsElement
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved