Class BeginPageLayoutEventArgs
Provides data for event before lay outing the new page.
Inheritance
System.Object
System.EventArgs
BeginPageLayoutEventArgs
Inherited Members
System.EventArgs.Empty
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class BeginPageLayoutEventArgs : PdfCancelEventArgs
Examples
// Create a PDF document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
private bool m_paginateStart = true;
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfPen pen = new PdfPen(Color.Black, 1f);
//Creates a new pdf font
PdfStandardFont pdfFont = new PdfStandardFont(PdfFontFamily.Helvetica, 11.5f);
Font font = new Font("Calibri", 14f, FontStyle.Bold);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font, true);
string path = @"..\..\Data\Essential studio.txt";
StreamReader reader = new StreamReader(path, Encoding.ASCII);
string text = reader.ReadToEnd();
reader.Close();
RectangleF column = new RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height);
//Create text element
PdfTextElement element = new PdfTextElement(text, pdfFont);
element.Brush = new PdfSolidBrush(Color.Black);
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Raise the event when the text flows to next page.
element.BeginPageLayout += new BeginPageLayoutEventHandler(BeginPageLayout2);
//Get the remaining text that flows beyond the boundary.
PdfTextLayoutResult result = element.Draw(page, column, layoutFormat);
//Saves the document.
doc.Save("Sample.pdf");
//Begin Page Layout Event Handler
private void BeginPageLayout2(object sender, BeginPageLayoutEventArgs e)
{
RectangleF bounds = e.Bounds;
// First column.
if (!m_paginateStart)
{
bounds.X = bounds.Width + 20f;
bounds.Y = 10f;
}
e.Bounds = bounds;
}
'Create a PDF document
Dim doc As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = doc.Pages.Add()
Dim m_paginateStart As Bool= True
Dim brush As New PdfSolidBrush(Color.Black)
Dim pen As New PdfPen(Color.Black, 1f)
'Creates a new pdf font
Dim pdfFont As New PdfStandardFont(PdfFontFamily.Helvetica, 11.5f)
Dim font As New Font("Calibri", 14f, FontStyle.Bold)
Dim trueTypeFont As New PdfTrueTypeFont(font, True)
Dim path As string = "..\..\..\..\..\..\..\..\..\Common\Data\PDF\Essential studio.txt"
Dim reader As New StreamReader(path, Encoding.ASCII)
Dim text As string = reader.ReadToEnd()
reader.Close()
Dim column As New RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height)
'Create text element
Dim element As New PdfTextElement(text, pdfFont)
element.Brush = New PdfSolidBrush(Color.Black)
Dim layoutFormat As New PdfLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Raise the event when the text flows to next page.
element.BeginPageLayout += New BeginPageLayoutEventHandler(BeginPageLayout2)
'Get the remaining text that flows beyond the boundary.
Dim result As PdfTextLayoutResult = element.Draw(page, column, layoutFormat)
'Saves the document.
doc.Save("Sample.pdf")
'Begin Page Layout Event Handler
Private Sub BeginPageLayout2(ByVal sender As object, ByVal e As BeginPageLayoutEventArgs)
Dim bounds As RectangleF = e.Bounds
' First column.
If (Not m_paginateStart) Then
bounds.X = bounds.Width + 20f
bounds.Y = 10f
End If
e.Bounds = bounds
End Sub
Constructors
BeginPageLayoutEventArgs(RectangleF, PdfPage)
Initializes a new instance of the BeginPageLayoutEventArgs class with the specified rectangle and page
Declaration
public BeginPageLayoutEventArgs(RectangleF bounds, PdfPage page)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | bounds | The bounds. |
PdfPage | page | The page. |
Properties
Bounds
Gets or sets value that indicates the lay outing bounds on the page.
Declaration
public RectangleF Bounds { get; set; }
Property Value
Type |
---|
System.Drawing.RectangleF |
Examples
// Create a PDF document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
private bool m_paginateStart = true;
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfPen pen = new PdfPen(Color.Black, 1f);
//Creates a new pdf font
PdfStandardFont pdfFont = new PdfStandardFont(PdfFontFamily.Helvetica, 11.5f);
Font font = new Font("Calibri", 14f, FontStyle.Bold);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font, true);
string path = @"..\..\Data\Essential studio.txt";
StreamReader reader = new StreamReader(path, Encoding.ASCII);
string text = reader.ReadToEnd();
reader.Close();
RectangleF column = new RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height);
//Create text element
PdfTextElement element = new PdfTextElement(text, pdfFont);
element.Brush = new PdfSolidBrush(Color.Black);
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Raise the event when the text flows to next page.
element.BeginPageLayout += new BeginPageLayoutEventHandler(BeginPageLayout2);
//Get the remaining text that flows beyond the boundary.
PdfTextLayoutResult result = element.Draw(page, column, layoutFormat);
//Saves the document.
doc.Save("Sample.pdf");
//Begin Page Layout Event Handler
private void BeginPageLayout2(object sender, BeginPageLayoutEventArgs e)
{
RectangleF bounds = e.Bounds;
// First column.
if (!m_paginateStart)
{
bounds.X = bounds.Width + 20f;
bounds.Y = 10f;
}
e.Bounds = bounds;
}
'Create a PDF document
Dim doc As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = doc.Pages.Add()
Dim m_paginateStart As Bool= True
Dim brush As New PdfSolidBrush(Color.Black)
Dim pen As New PdfPen(Color.Black, 1f)
'Creates a new pdf font
Dim pdfFont As New PdfStandardFont(PdfFontFamily.Helvetica, 11.5f)
Dim font As New Font("Calibri", 14f, FontStyle.Bold)
Dim trueTypeFont As New PdfTrueTypeFont(font, True)
Dim path As string = "..\..\..\..\..\..\..\..\..\Common\Data\PDF\Essential studio.txt"
Dim reader As New StreamReader(path, Encoding.ASCII)
Dim text As string = reader.ReadToEnd()
reader.Close()
Dim column As New RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height)
'Create text element
Dim element As New PdfTextElement(text, pdfFont)
element.Brush = New PdfSolidBrush(Color.Black)
Dim layoutFormat As New PdfLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Raise the event when the text flows to next page.
element.BeginPageLayout += New BeginPageLayoutEventHandler(BeginPageLayout2)
'Get the remaining text that flows beyond the boundary.
Dim result As PdfTextLayoutResult = element.Draw(page, column, layoutFormat)
'Saves the document.
doc.Save("Sample.pdf")
'Begin Page Layout Event Handler
Private Sub BeginPageLayout2(ByVal sender As object, ByVal e As BeginPageLayoutEventArgs)
Dim bounds As RectangleF = e.Bounds
' First column.
If (Not m_paginateStart) Then
bounds.X = bounds.Width + 20f
bounds.Y = 10f
End If
e.Bounds = bounds
End Sub
Page
Gets the page where the lay outing should start.
Declaration
public PdfPage Page { get; }
Property Value
Type |
---|
PdfPage |
Examples
// Create a PDF document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
private bool m_paginateStart = true;
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfPen pen = new PdfPen(Color.Black, 1f);
//Creates a new pdf font
PdfStandardFont pdfFont = new PdfStandardFont(PdfFontFamily.Helvetica, 11.5f);
Font font = new Font("Calibri", 14f, FontStyle.Bold);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font, true);
string path = @"..\..\Data\Essential studio.txt";
StreamReader reader = new StreamReader(path, Encoding.ASCII);
string text = reader.ReadToEnd();
reader.Close();
RectangleF column = new RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height);
//Create text element
PdfTextElement element = new PdfTextElement(text, pdfFont);
element.Brush = new PdfSolidBrush(Color.Black);
PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Raise the event when the text flows to next page.
element.BeginPageLayout += new BeginPageLayoutEventHandler(BeginPageLayout2);
//Get the remaining text that flows beyond the boundary.
PdfTextLayoutResult result = element.Draw(page, column, layoutFormat);
//Saves the document.
doc.Save("Sample.pdf");
//Begin Page Layout Event Handler
private void BeginPageLayout2(object sender, BeginPageLayoutEventArgs e)
{
PdfPage page = e.pAGE;
}
'Create a PDF document
Dim doc As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = doc.Pages.Add()
Dim m_paginateStart As Bool= True
Dim brush As New PdfSolidBrush(Color.Black)
Dim pen As New PdfPen(Color.Black, 1f)
'Creates a new pdf font
Dim pdfFont As New PdfStandardFont(PdfFontFamily.Helvetica, 11.5f)
Dim font As New Font("Calibri", 14f, FontStyle.Bold)
Dim trueTypeFont As New PdfTrueTypeFont(font, True)
Dim path As string = "..\..\..\..\..\..\..\..\..\Common\Data\PDF\Essential studio.txt"
Dim reader As New StreamReader(path, Encoding.ASCII)
Dim text As string = reader.ReadToEnd()
reader.Close()
Dim column As New RectangleF(0, 20, page.Graphics.ClientSize.Width / 2f - 10f, page.Graphics.ClientSize.Height)
'Create text element
Dim element As New PdfTextElement(text, pdfFont)
element.Brush = New PdfSolidBrush(Color.Black)
Dim layoutFormat As New PdfLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Raise the event when the text flows to next page.
element.BeginPageLayout += New BeginPageLayoutEventHandler(BeginPageLayout2)
'Get the remaining text that flows beyond the boundary.
Dim result As PdfTextLayoutResult = element.Draw(page, column, layoutFormat)
'Saves the document.
doc.Save("Sample.pdf")
'Begin Page Layout Event Handler
Private Sub BeginPageLayout2(ByVal sender As object, ByVal e As BeginPageLayoutEventArgs)
Dim page As PdfPage = e.Page
End Sub