Table of Contents

Class PdfCompositeField

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Represents class which can concatenate multiple automatic fields into single string.

public class PdfCompositeField : PdfMultipleValueField
Inheritance
PdfCompositeField
Inherited Members

Examples

//Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
PdfBrush brush = PdfBrushes.Black;
//Create a composite field
PdfCompositeField compositeField = new PdfCompositeField(font, brush);
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document
doc.Save("AutomaticField.pdf");
doc.Close(true);
 'Creates a new document
 Dim doc As New PdfDocument()
 Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
 Dim brush As PdfBrush = PdfBrushes.Black
'Create a composite field
 Dim compositeField As New PdfCompositeField(font, brush)
 compositeField.Text = "AutomaticFields"
 For i As Integer = 0 To 2
 ' Creates a new page
 Dim page As PdfPage = doc.Pages.Add()
 ' compositeField.Draw(page.Graphics)
 Next i
'Save and close the document
 doc.Save("AutomaticField.pdf")
 doc.Close(True)

Constructors

PdfCompositeField()

Initializes a new instance of the PdfCompositeField class.

public PdfCompositeField()

Examples

//Creates a new document.
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
PdfBrush brush = PdfBrushes.Black;
//Create a composite field.
PdfCompositeField compositeField = new PdfCompositeField();
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page.
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("AutomaticField.pdf");
doc.Close(true);
'Creates a new document.
Dim doc As New PdfDocument()
'Create a composite field.
Dim compositeField As New PdfCompositeField()
compositeField.Text = "AutomaticFields"
For i As Integer = 0 To 2
' Creates a new page
Dim page As PdfPage = doc.Pages.Add()
' compositeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("AutomaticField.pdf")
doc.Close(True)
See Also

PdfCompositeField(PdfFont)

Initializes a new instance of the PdfCompositeField class with PdfFont

public PdfCompositeField(PdfFont font)

Parameters

font PdfFont

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

Examples

// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Create a composite field
PdfCompositeField compositeField = new PdfCompositeField(font);
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document
doc.Save("AutomaticField.pdf");
doc.Close(true);
'Creates a new document.
Dim doc As New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
'Create a composite field.
Dim compositeField As New PdfCompositeField(font)
compositeField.Text = "AutomaticFields"
For i As Integer = 0 To 2
' Creates a new page
Dim page As PdfPage = doc.Pages.Add()
' compositeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("AutomaticField.pdf")
doc.Close(True)
See Also

PdfCompositeField(PdfFont, PdfBrush)

Initializes a new instance of the PdfCompositeField class with PdfFont and PdfBrush

public PdfCompositeField(PdfFont font, PdfBrush brush)

Parameters

font PdfFont

The PdfFontobject that specifies the font attributes (the family name, the size, and the style of the font) to use.

brush PdfBrush

The PdfBrush specifies the color and texture to the text.

Examples

//Creates a new document.
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
PdfBrush brush = PdfBrushes.Black;
//Create a composite field.
PdfCompositeField compositeField = new PdfCompositeField(font, brush);
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page.
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("AutomaticField.pdf");
doc.Close(true);
'Creates a new document.
Dim doc As New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
Dim brush As PdfBrush = PdfBrushes.Black
'Create a composite field.
Dim compositeField As New PdfCompositeField(font, brush)
compositeField.Text = "AutomaticFields"
For i As Integer = 0 To 2
' Creates a new page
Dim page As PdfPage = doc.Pages.Add()
' compositeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("AutomaticField.pdf")
doc.Close(True)
See Also

PdfCompositeField(PdfFont, PdfBrush, string)

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

public PdfCompositeField(PdfFont font, PdfBrush brush, string text)

Parameters

font PdfFont

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

brush PdfBrush

A PdfBrush object that is used to fill the string.

text string

The wide-character string to be drawn.

Examples

// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
PdfBrush brush = PdfBrushes.Black;
//Create a composite field
PdfCompositeField compositeField = new PdfCompositeField(font,brush,"AutomaticField");
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document
doc.Save("AutomaticField.pdf");
doc.Close(true);
 'Creates a new document.
 Dim doc As New PdfDocument()
 Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
 Dim brush As PdfBrush = PdfBrushes.Black
 'Create a composite field.
 Dim compositeField As New PdfCompositeField(font,brush,"AutomaticField")
 compositeField.Text = "AutomaticFields"
 For i As Integer = 0 To 2
 ' Creates a new page
 Dim page As PdfPage = doc.Pages.Add()
 ' compositeField.Draw(page.Graphics)
 Next i
'Save and close the document.
 doc.Save("AutomaticField.pdf")
 doc.Close(True)
See Also

PdfCompositeField(PdfFont, PdfBrush, string, params PdfAutomaticField[])

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

public PdfCompositeField(PdfFont font, PdfBrush brush, string text, params PdfAutomaticField[] list)

Parameters

font PdfFont

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

brush PdfBrush

A PdfBrush object that is used to fill the string.

text string

The wide-character string to be drawn.

list PdfAutomaticField[]

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

PdfCompositeField(PdfFont, string)

Initializes a new instance of the PdfCompositeField class with PdfFont and text

public PdfCompositeField(PdfFont font, string text)

Parameters

font PdfFont

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

text string

The wide-character string to be drawn.

Examples

//Creates a new document.
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Create a composite field.
PdfCompositeField compositeField = new PdfCompositeField(font,"AutomaticField");
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page.
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("AutomaticField.pdf");
doc.Close(true);
'Creates a new document.
Dim doc As New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
'Create a composite field.
Dim compositeField As New PdfCompositeField(font,"AutomaticField")
compositeField.Text = "AutomaticFields"
For i As Integer = 0 To 2
' Creates a new page
Dim page As PdfPage = doc.Pages.Add()
' compositeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("AutomaticField.pdf")
doc.Close(True)
See Also

PdfCompositeField(PdfFont, string, params PdfAutomaticField[])

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

public PdfCompositeField(PdfFont font, string text, params PdfAutomaticField[] list)

Parameters

font PdfFont

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

text string

The wide-character string to be drawn.

list PdfAutomaticField[]

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

PdfCompositeField(string, params PdfAutomaticField[])

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

public PdfCompositeField(string text, params PdfAutomaticField[] list)

Parameters

text string

The wide-character string to be drawn.

list PdfAutomaticField[]

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

Properties

AutomaticFields

Gets or sets the automatic fields.

public PdfAutomaticField[] AutomaticFields { get; set; }

Property Value

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

Text

Gets or sets the text.

public string Text { get; set; }

Property Value

string

The wide-character string to be drawn.

Examples

//Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
PdfBrush brush = PdfBrushes.Black;
//Create a composite field
PdfCompositeField compositeField = new PdfCompositeField(font, brush);
compositeField.Text = "AutomaticFields";
for (int i = 0; i != 3; i++)
{
//Creates a new page
PdfPage page = doc.Pages.Add();
compositeField.Draw(page.Graphics);
}
//Save and close the document
doc.Save("AutomaticField.pdf");
doc.Close(true);
'Creates a new document
Dim doc As New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F)
Dim brush As PdfBrush = PdfBrushes.Black
'Create a composite field
Dim compositeField As New PdfCompositeField(font, brush)
compositeField.Text = "AutomaticFields"
For i As Integer = 0 To 2
' Creates a new page
Dim page As PdfPage = doc.Pages.Add()
' compositeField.Draw(page.Graphics)
Next i
'Save and close the document
doc.Save("AutomaticField.pdf")
doc.Close(True)
See Also

Methods

GetValue(PdfGraphics)

Gets the value of the field at the specified graphics.

protected override string GetValue(PdfGraphics graphics)

Parameters

graphics PdfGraphics

The graphics.

Returns

string
See Also

See Also