Table of Contents

Class PdfTextElement

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

Represents the text area with the ability to span several pages and inherited from the PdfLayoutElement class

public class PdfTextElement : PdfLayoutElement
Inheritance
PdfTextElement
Derived
Inherited Members

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfBrushes.Black);
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfBrushes.Black)
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Constructors

PdfTextElement()

Initializes a new instance of the PdfTextElement class.

public PdfTextElement()

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement();
 //Set text.
 element.Text = "Hello World!!!";
 //Set font.
 element.Font = font;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement()
'Set text.
element.Text = "Hello World!!!"
'Set font.
element.Font = font
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

PdfTextElement(string)

Initializes a new instance of the PdfTextElement class with text to draw into the PDF.

public PdfTextElement(string text)

Parameters

text string

The text to draw into the PDF.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!");        
 //Set font.
 element.Font = font;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!")      
'Set font.
element.Font = font
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

PdfTextElement(string, PdfFont)

Initializes a new instance of the PdfTextElement class with the text and PdfFont.

public PdfTextElement(string text, PdfFont font)

Parameters

text string

The text to draw into the PDF.

font PdfFont

The PdfFont that defines the text format.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font);
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font)
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

PdfTextElement(string, PdfFont, PdfBrush)

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

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

Parameters

text string

The text to draw into the PDF.

font PdfFont

The PdfFont that defines the text format.

brush PdfBrush

The PdfBrush that determines the color and texture of the drawn text.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfBrushes.Black);
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfBrushes.Black)
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

PdfTextElement(string, PdfFont, PdfPen)

Initializes a new instance of the PdfTextElement class with text,PdfFont and PdfPen.

public PdfTextElement(string text, PdfFont font, PdfPen pen)

Parameters

text string

The text to draw into the PDF.

font PdfFont

The PdfFont that defines the text format.

pen PdfPen

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

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfPens.Black);
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfPens.Black)
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

PdfTextElement(string, PdfFont, PdfPen, PdfBrush, PdfStringFormat)

Initializes a new instance of the PdfTextElement class with text,PdfFont,PdfPen,PdfBrush and PdfStringFormat.

public PdfTextElement(string text, PdfFont font, PdfPen pen, PdfBrush brush, PdfStringFormat format)

Parameters

text string

The text to draw into the PDF.

font PdfFont

The PdfFont that defines the text format.

pen PdfPen

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

brush PdfBrush

The PdfBrush that determines the color and texture of the drawn text.

format PdfStringFormat

The PdfStringFormat that determines string format.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF string format.
 PdfStringFormat format = new PdfStringFormat();
 //Set alignments.
 format.Alignment = PdfTextAlignment.Center;
 format.LineAlignment = PdfVerticalAlignment.Middle;
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfPens.Red, PdfBrushes.Black, format);
 //Draw the text element.
 element.Draw(page, new RectangleF(0, 0, 200, 20));
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF string format.
Dim format As New PdfStringFormat()
'Set alignments.
format.Alignment = PdfTextAlignment.Center
format.LineAlignment = PdfVerticalAlignment.Middle
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfPens.Red, PdfBrushes.Black, format)
'Draw the text element.
element.Draw(page, New RectangleF(0, 0, 200, 20))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Properties

Brush

Gets or sets the PdfBrush that will be used to draw the text with color and texture.

public PdfBrush Brush { get; set; }

Property Value

PdfBrush

The PdfBrush that determines the color and texture of the drawn text

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement();
 //Set text.
 element.Text = "Hello World!!!";
 //Set font.
 element.Font = font;
 //Set PDF brush.
 element.Brush = PdfBrushes.RoyalBlue;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement()
'Set text.
element.Text = "Hello World!!!"
'Set font.
element.Font = font
'Set PDF brush.
element.Brush = PdfBrushes.RoyalBlue
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Font

Gets or sets a PdfFont that defines the text format.

public PdfFont Font { get; set; }

Property Value

PdfFont

The PdfFont that defines the text format

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement();
 //Set text.
 element.Text = "Hello World!!!";
 //Set font.
 element.Font = font;
 //Set PDF brush.
 element.Brush = PdfBrushes.RoyalBlue;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement()
'Set text.
element.Text = "Hello World!!!"
'Set font.
element.Font = font
'Set PDF brush.
element.Brush = PdfBrushes.RoyalBlue
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Pen

Gets or sets a PdfPen that determines the color, width, and style of the text

public PdfPen Pen { get; set; }

Property Value

PdfPen

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

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement();
 //Set text.
 element.Text = "Hello World!!!";
 //Set font.
 element.Font = font;
 //Set PDF pen.
 element.Pen = PdfPens.Red;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement()
'Set text.
element.Text = "Hello World!!!"
'Set font.
element.Font = font
'Set PDF pen.
element.Pen = PdfPens.Red
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

StringFormat

Gets or sets the PdfStringFormat that will be used to set the string format

public PdfStringFormat StringFormat { get; set; }

Property Value

PdfStringFormat

The PdfStringFormat used to set the string format

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF string format.
 PdfStringFormat format = new PdfStringFormat();
 //Set alignments.
 format.Alignment = PdfTextAlignment.Center;
 format.LineAlignment = PdfVerticalAlignment.Middle;
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfPens.Red);
 //Set PDF string format.
 element.StringFormat = format;
 //Draw the text element.
 element.Draw(page, new RectangleF(0, 0, 200, 20));
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF string format.
Dim format As New PdfStringFormat()
'Set alignments.
format.Alignment = PdfTextAlignment.Center
format.LineAlignment = PdfVerticalAlignment.Middle
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfPens.Red)
'Draw the text element.
element.Draw(page, New RectangleF(0, 0, 200, 20))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Text

Gets or sets a value indicating the text that should be printed.

public string Text { get; set; }

Property Value

string

The string to draw to the PDF

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement();
 //Set text.
 element.Text = "Hello World!!!";
 //Set font.
 element.Font = font;
 //Draw the text element.
 element.Draw(graphics);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement()
'Set text.
element.Text = "Hello World!!!"
'Set font.
element.Font = font
'Draw the text element.
element.Draw(graphics)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Methods

Draw(PdfPage, PointF, PdfLayoutFormat)

Draws the text on the page in the specified location with PdfLayoutFormat. It returns the PdfTextLayoutResult which contains last page and bounds where the text element drawn.

public PdfTextLayoutResult Draw(PdfPage page, PointF location, PdfLayoutFormat format)

Parameters

page PdfPage

Current page where the text should be drawn.

location PointF

PointF structure that specifies the start location on the page.

format PdfLayoutFormat

The PdfLayoutFormat that represents the layout settings

Returns

PdfTextLayoutResult

The PdfTextLayoutResult that represents the layout result of the drawn text.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfBrushes.Black);
 //Create layout format
 PdfLayoutFormat format=new PdfLayoutFormat();
 format.Layout=PdfLayoutType.Paginate;
 //Draw the text with layout format
 element.Draw(page, new PointF(0, 0), format);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfBrushes.Black)
'Create layout format
Dim format As New PdfLayoutFormat()
format.Layout = PdfLayoutType.Paginate
'Draw the text with layout format
element.Draw(page, New PointF(0, 0), format)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Draw(PdfPage, PointF, float, PdfLayoutFormat)

Draws the text on the page in the specified location,width and PdfLayoutFormat. It returns the PdfTextLayoutResult which contains last page and bounds where the text element drawn

public PdfTextLayoutResult Draw(PdfPage page, PointF location, float width, PdfLayoutFormat format)

Parameters

page PdfPage

Current page where the text should be drawn.

location PointF

PointF structure that specifies the start location on the page.

width float

Width of the text bounds.

format PdfLayoutFormat

The PdfLayoutFormat that represents the layout settings

Returns

PdfTextLayoutResult

The PdfTextLayoutResult that represents the layout result of the drawn text.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfBrushes.Black);
 //Create layout format
 PdfLayoutFormat format=new PdfLayoutFormat();
 format.Layout=PdfLayoutType.Paginate;
 //Draw the text with layout format
 element.Draw(page, new PointF(0, 0), 200, format);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfBrushes.Black)
'Create layout format
Dim format As New PdfLayoutFormat()
format.Layout = PdfLayoutType.Paginate
'Draw the text with layout format
element.Draw(page, New PointF(0, 0), 200, format)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

Draw(PdfPage, RectangleF, PdfLayoutFormat)

Draws the text on the page with specified layout rectangle and PdfLayoutFormat. It returns the PdfTextLayoutResult which contains last page and bounds where the text element drawn.

public PdfTextLayoutResult Draw(PdfPage page, RectangleF layoutRectangle, PdfLayoutFormat format)

Parameters

page PdfPage

Current page where the text should be drawn.

layoutRectangle RectangleF

RectangleF structure that specifies the bounds of the text.

format PdfLayoutFormat

The PdfLayoutFormat that represents the layout settings

Returns

PdfTextLayoutResult

The PdfTextLayoutResult that represents the layout result of the drawn text.

Examples

//Create a new PDF document.
 PdfDocument document = new PdfDocument();
 //Add a page to the document.
 PdfPage page = document.Pages.Add();
 //Create PDF graphics for the page.
 PdfGraphics graphics = page.Graphics;
 //Use the font installed in the machine
 PdfFont font = new PdfTrueTypeFont(new Font("Arial", 14));
 //Create PDF text element
 PdfTextElement element = new PdfTextElement("Hello World!!!", font, PdfBrushes.Black);
 //Create layout format
 PdfLayoutFormat format=new PdfLayoutFormat();
 format.Layout=PdfLayoutType.Paginate;
 //Draw the text with layout format
 element.Draw(page, new RectangleF(0, 0, 200, 400), format);
 //Save the document.
 document.Save("Output.pdf");
 //Close the document.
 document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Use the font installed in the machine
Dim font As PdfFont = New PdfTrueTypeFont(New Font("Arial", 14))
'Create PDF text element
Dim element As New PdfTextElement("Hello World!!!", font, PdfBrushes.Black)
'Create layout format
Dim format As New PdfLayoutFormat()
format.Layout = PdfLayoutType.Paginate
'Draw the text with layout format
element.Draw(page, New RectangleF(0, 0, 200, 400), format)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)

DrawInternal(PdfGraphics)

Draws an element on the Graphics.

protected override void DrawInternal(PdfGraphics graphics)

Parameters

graphics PdfGraphics

Graphics context where the element should be printed.

Layout(PdfLayoutParams)

Layouts the element.

protected override PdfLayoutResult Layout(PdfLayoutParams param)

Parameters

param PdfLayoutParams

Lay outing parameters.

Returns

PdfLayoutResult

Returns lay outing results.