Class PdfCompositeField
Represents class which can concatenate multiple automatic fields into single string.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfCompositeField : PdfMultipleValueField
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.
Declaration
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
Declaration
public PdfCompositeField(PdfFont font)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | 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
Declaration
public PdfCompositeField(PdfFont font, PdfBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | The PdfFontobject that specifies the font attributes (the family name, the size, and the style of the font) to use. |
PdfBrush | brush | 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.
Declaration
public PdfCompositeField(PdfFont font, PdfBrush brush, string text)
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. |
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)
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
PdfCompositeField(PdfFont, String)
Initializes a new instance of the PdfCompositeField class with PdfFont and text
Declaration
public PdfCompositeField(PdfFont font, string text)
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. |
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, 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
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
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
Text
Gets or sets the text.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.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)