Class PageAddedEventArgs
Provides data for PageAddedEventHandler event.
Inheritance
System.Object
System.EventArgs
PageAddedEventArgs
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
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PageAddedEventArgs : EventArgs
Remarks
This event raises when adding the new PdfPage to the PdfDocument.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the event.
document.Pages.PageAdded += new PageAddedEventHandler(Pages_PageAdded);
//Creates a new page and adds it as the last page of the document.
PdfPage page = document.Pages.Add();
//Create font with Bold font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, new PointF(10, 10));
page = document.Pages.Add();
//Save and close the document.
document.Save("Sample.pdf");
document.Close(true);
//Event handler for PageAdded event.
void Pages_PageAdded(object sender, PageAddedEventArgs args)
{
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 10);
args.Page.Graphics.DrawString("New Page", font, PdfBrushes.Black, new PointF(100, 100));
}
'Create a new PDF document.
Dim document As New PdfDocument()
'Add the event.
document.Pages.PageAdded += New PageAddedEventHandler(Pages_PageAdded)
'Creates a new page and adds it as the last page of the document.
Dim page As PdfPage = document.Pages.Add()
'Create font with Bold font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, New PointF(10, 10))
page = document.Pages.Add()
'Save and close the document.
document.Save("Sample.pdf")
document.Close(True)
'Event handler for PageAdded event.
Private Sub Pages_PageAdded(sender As Object, args As PageAddedEventArgs)
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 10)
args.Page.Graphics.DrawString("New Page", font, PdfBrushes.Black, New PointF(100, 100))
End Sub
Constructors
PageAddedEventArgs(PdfPage)
Initializes a new instance of the PageAddedEventArgs class with PdfPage.
Declaration
public PageAddedEventArgs(PdfPage page)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | A PdfPage object representing the page which is added in the document. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the event.
document.Pages.PageAdded += new PageAddedEventHandler(Pages_PageAdded);
//Creates a new page and adds it as the last page of the document.
PdfPage page = document.Pages.Add();
//Create font with Bold font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, new PointF(10, 10));
page = document.Pages.Add();
//Save and close the document.
document.Save("Sample.pdf");
document.Close(true);
//Event handler for PageAdded event.
void Pages_PageAdded(object sender, PageAddedEventArgs args)
{
PdfPage page = args.Page;
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 10);
page.Graphics.DrawString("New Page", font, PdfBrushes.Black, new PointF(100, 100));
}
'Create a new PDF document.
Dim document As New PdfDocument()
'Add the event.
document.Pages.PageAdded += New PageAddedEventHandler(Pages_PageAdded)
'Creates a new page and adds it as the last page of the document.
Dim page As PdfPage = document.Pages.Add()
'Create font with Bold font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, New PointF(10, 10))
page = document.Pages.Add()
'Save and close the document.
document.Save("Sample.pdf")
document.Close(True)
'Event handler for PageAdded event.
Private Sub Pages_PageAdded(sender As Object, args As PageAddedEventArgs)
Dim page As PdfPage = args.Page
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 10)
page.Graphics.DrawString("New Page", font, PdfBrushes.Black, New PointF(100, 100))
End Sub
See Also
Properties
Page
Gets the newly added page.
Declaration
public PdfPage Page { get; }
Property Value
Type | Description |
---|---|
PdfPage | A PdfPage object representing the page which is added in the document. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the event.
document.Pages.PageAdded += new PageAddedEventHandler(Pages_PageAdded);
//Creates a new page and adds it as the last page of the document.
PdfPage page = document.Pages.Add();
//Create font with Bold font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, new PointF(10, 10));
page = document.Pages.Add();
//Save and close the document.
document.Save("Sample.pdf");
document.Close(true);
//Event handler for PageAdded event
void Pages_PageAdded(object sender, PageAddedEventArgs args)
{
PdfPage page = args.Page;
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 10);
page.Graphics.DrawString("New Page", font, PdfBrushes.Black, new PointF(100, 100));
}
'Create a new PDF document.
Dim document As New PdfDocument()
'Add the event.
document.Pages.PageAdded += New PageAddedEventHandler(Pages_PageAdded)
'Creates a new page and adds it as the last page of the document.
Dim page As PdfPage = document.Pages.Add()
'Create font with Bold font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Draw text in the new page.
page.Graphics.DrawString("Essential PDF", font, PdfBrushes.Black, New PointF(10, 10))
page = document.Pages.Add()
'Save and close the document.
document.Save("Sample.pdf")
document.Close(True)
'Event handler for PageAdded event.
Private Sub Pages_PageAdded(sender As Object, args As PageAddedEventArgs)
Dim page As PdfPage = args.Page
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 10)
page.Graphics.DrawString("New Page", font, PdfBrushes.Black, New PointF(100, 100))
End Sub