Class PdfLayoutElement
Represents the base class for all elements that can be layout on the pages.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public abstract class PdfLayoutElement : PdfGraphicsElement
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()
Declaration
protected PdfLayoutElement()
Properties
PdfTag
Gets or sets the tag for the element
Declaration
public PdfTag PdfTag { get; set; }
Property Value
Type | Description |
---|---|
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 System.Drawing.PointF structure
Declaration
public PdfLayoutResult Draw(PdfPage page, PointF location)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Drawing.PointF | location | Start location on the page. |
Returns
Type | Description |
---|---|
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, System.Drawing.PointF structure and layout format
Declaration
public PdfLayoutResult Draw(PdfPage page, PointF location, PdfLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Drawing.PointF | location | Start location on the page. |
PdfLayoutFormat | format | PdfLayoutFormat that represents the layout settings |
Returns
Type | Description |
---|---|
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 System.Drawing.RectangleF structure
Declaration
public PdfLayoutResult Draw(PdfPage page, RectangleF layoutRectangle)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Drawing.RectangleF | layoutRectangle | RectangleF structure that specifies the bounds of the element. |
Returns
Type | Description |
---|---|
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, System.Drawing.RectangleF structure and layout format
Declaration
public PdfLayoutResult Draw(PdfPage page, RectangleF layoutRectangle, PdfLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Drawing.RectangleF | layoutRectangle | RectangleF structure that specifies the bounds of the element. |
PdfLayoutFormat | format | PdfLayoutFormat that represents the layout settings |
Returns
Type | Description |
---|---|
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, Single, Single)
Draws the element on the page with the specified page and pair of coordinates
Declaration
public PdfLayoutResult Draw(PdfPage page, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Single | x | X co-ordinate of the element on the page. |
System.Single | y | Y co-ordinate of the element on the page. |
Returns
Type | Description |
---|---|
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, Single, Single, PdfLayoutFormat)
Draws the element on the page with the specified page, pair of coordinates and layout format
Declaration
public PdfLayoutResult Draw(PdfPage page, float x, float y, PdfLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | Current page where the element should be drawn. |
System.Single | x | X co-ordinate of the element on the page. |
System.Single | y | Y co-ordinate of the element on the page. |
PdfLayoutFormat | format | PdfLayoutFormat that represents the layout settings |
Returns
Type | Description |
---|---|
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.
Declaration
protected abstract PdfLayoutResult Layout(PdfLayoutParams param)
Parameters
Type | Name | Description |
---|---|---|
PdfLayoutParams | param | Layout parameters. |
Returns
Type | Description |
---|---|
PdfLayoutResult | Returns the results of layout. |
Layout(HtmlToPdfLayoutParams)
Layouts the specified param.
Declaration
protected virtual PdfLayoutResult Layout(HtmlToPdfLayoutParams param)
Parameters
Type | Name | Description |
---|---|---|
HtmlToPdfLayoutParams | param | The param. |
Returns
Type | Description |
---|---|
PdfLayoutResult | null |
Events
BeginPageLayout
Raises before the element should be printed on the page.
Declaration
public event BeginPageLayoutEventHandler BeginPageLayout
Event Type
Type | Description |
---|---|
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.
Declaration
public event EndPageLayoutEventHandler EndPageLayout
Event Type
Type | Description |
---|---|
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)