Table of Contents

Class PdfLayoutElement

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

Represents the base class for all elements that can be layout on the pages.

public abstract class PdfLayoutElement : PdfGraphicsElement
Inheritance
PdfLayoutElement
Derived
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Constructors

PdfLayoutElement()

protected PdfLayoutElement()

Properties

PdfTag

Gets or sets the tag for the element

public PdfTag PdfTag { get; set; }

Property Value

PdfTag

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Set PDF tag element.
rect.PdfTag = new PdfStructureElement(PdfTagType.Figure);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Methods

Draw(PdfPage, PointF)

Draws the element on the page with the specified page and Syncfusion.Drawing.PointF structure

public PdfLayoutResult Draw(PdfPage page, PointF location)

Parameters

page PdfPage

Current page where the element should be drawn.

location PointF

Start location on the page.

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfPage, PointF, PdfLayoutFormat)

Draws the element on the page with the specified page, Syncfusion.Drawing.PointF structure and layout format

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

Parameters

page PdfPage

Current page where the element should be drawn.

location PointF

Start location on the page.

format PdfLayoutFormat

PdfLayoutFormat that represents the layout settings

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Create new PDF layout format.
PdfLayoutFormat format = new PdfLayoutFormat();
//Set layout.
format.Layout = PdfLayoutType.Paginate;
//Set break type.
format.Break = PdfLayoutBreakType.FitPage; 
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, PointF.Empty, format);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Create new PDF layout format.
Dim format As New PdfLayoutFormat()
'Set layout.
format.Layout = PdfLayoutType.Paginate
'Set break type.
format.Break = PdfLayoutBreakType.FitPage
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, PointF.Empty, format)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfPage, RectangleF)

Draws the element on the page with the specified page and Syncfusion.Drawing.RectangleF structure

public PdfLayoutResult Draw(PdfPage page, RectangleF layoutRectangle)

Parameters

page PdfPage

Current page where the element should be drawn.

layoutRectangle RectangleF

RectangleF structure that specifies the bounds of the element.

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 1000);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, new RectangleF(10, 10, 300, 500));
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 1000)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, New RectangleF(10, 10, 300, 500))
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfPage, RectangleF, PdfLayoutFormat)

Draws the element on the page with the specified page, Syncfusion.Drawing.RectangleF structure and layout format

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

Parameters

page PdfPage

Current page where the element should be drawn.

layoutRectangle RectangleF

RectangleF structure that specifies the bounds of the element.

format PdfLayoutFormat

PdfLayoutFormat that represents the layout settings

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Create new PDF layout format.
PdfLayoutFormat format = new PdfLayoutFormat();
//Set layout.
format.Layout = PdfLayoutType.Paginate;
//Set break type.
format.Break = PdfLayoutBreakType.FitPage; 
//Create layout rectangle.
RectangleF layoutRect = new RectangleF(10, 10, 300, 500);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, layoutRect, format);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Create new PDF layout format.
Dim format As New PdfLayoutFormat()
'Set layout.
format.Layout = PdfLayoutType.Paginate
'Set break type.
format.Break = PdfLayoutBreakType.FitPage
'Create layout rectangle.
Dim layoutRect As New RectangleF(10, 10, 300, 500)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, layoutRect, format)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfPage, float, float)

Draws the element on the page with the specified page and pair of coordinates

public PdfLayoutResult Draw(PdfPage page, float x, float y)

Parameters

page PdfPage

Current page where the element should be drawn.

x float

X co-ordinate of the element on the page.

y float

Y co-ordinate of the element on the page.

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, 10, 10);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, 10, 10)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfPage, float, float, PdfLayoutFormat)

Draws the element on the page with the specified page, pair of coordinates and layout format

public PdfLayoutResult Draw(PdfPage page, float x, float y, PdfLayoutFormat format)

Parameters

page PdfPage

Current page where the element should be drawn.

x float

X co-ordinate of the element on the page.

y float

Y co-ordinate of the element on the page.

format PdfLayoutFormat

PdfLayoutFormat that represents the layout settings

Returns

PdfLayoutResult

PdfLayoutResult that represents the layout result of the drawn element.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Create new PDF layout format.
PdfLayoutFormat format = new PdfLayoutFormat();
//Set layout.
format.Layout = PdfLayoutType.Paginate;
//Set break type.
format.Break = PdfLayoutBreakType.FitPage; 
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, 10, 20, format);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Create new PDF layout format.
Dim format As New PdfLayoutFormat()
'Set layout.
format.Layout = PdfLayoutType.Paginate
'Set break type.
format.Break = PdfLayoutBreakType.FitPage
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, 10, 20, format)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Layout(PdfLayoutParams)

Layouts the element.

protected abstract PdfLayoutResult Layout(PdfLayoutParams param)

Parameters

param PdfLayoutParams

Layout parameters.

Returns

PdfLayoutResult

Returns the results of layout.

Layout(HtmlToPdfLayoutParams)

Layouts the specified param.

protected virtual PdfLayoutResult Layout(HtmlToPdfLayoutParams param)

Parameters

param HtmlToPdfLayoutParams

The param.

Returns

PdfLayoutResult

null

Events

BeginPageLayout

Raises before the element should be printed on the page.

public event BeginPageLayoutEventHandler BeginPageLayout

Event Type

BeginPageLayoutEventHandler

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Create new PDF layout format.
PdfLayoutFormat format = new PdfLayoutFormat();
//Set layout.
format.Layout = PdfLayoutType.Paginate;
//Set break type.
format.Break = PdfLayoutBreakType.FitPage; 
//Create layout rectangle.
RectangleF layoutRect = new RectangleF(10, 10, 300, 500);
//Raise begin page layout event.
rect.BeginPageLayout += Rect_BeginPageLayout;
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, layoutRect, format);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Create new PDF layout format.
Dim format As New PdfLayoutFormat()
'Set layout.
format.Layout = PdfLayoutType.Paginate
'Set break type.
format.Break = PdfLayoutBreakType.FitPage
'Create layout rectangle.
Dim layoutRect As New RectangleF(10, 10, 300, 500)
'Raise the begin page layout event.
AddHandler rect.BeginPageLayout, AddressOf Rect_BeginPageLayout
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, layoutRect, format)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

EndPageLayout

Raises after the element was printed on the page.

public event EndPageLayoutEventHandler EndPageLayout

Event Type

EndPageLayoutEventHandler

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(PdfBrushes.Red, 200, 800);
//Create new PDF layout format.
PdfLayoutFormat format = new PdfLayoutFormat();
//Set layout.
format.Layout = PdfLayoutType.Paginate;
//Set break type.
format.Break = PdfLayoutBreakType.FitPage; 
//Create layout rectangle.
RectangleF layoutRect = new RectangleF(10, 10, 300, 500);
//Raise end page layout event.
rect.EndPageLayout += Rect_EndPageLayout;
//Draw the rectangle to PDF page.
PdfLayoutResult result = rect.Draw(page, layoutRect, format);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(PdfBrushes.Red, 200, 800)
'Create new PDF layout format.
Dim format As New PdfLayoutFormat()
'Set layout.
format.Layout = PdfLayoutType.Paginate
'Set break type.
format.Break = PdfLayoutBreakType.FitPage
'Create layout rectangle.
Dim layoutRect As New RectangleF(10, 10, 300, 500)
'Raise the end page layout event
AddHandler rect.EndPageLayout, AddressOf Rect_EndPageLayout
'Draw the rectangle to PDF page.
Dim result As PdfLayoutResult = rect.Draw(page, layoutRect, format)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)