Class PageAddedEventHandler
Represents the method that executes on a PdfDocument when a new page is created.
Inheritance
System.Object
PageAddedEventHandler
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public sealed class PageAddedEventHandler : MulticastDelegate
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
PageAddedEventHandler(Object, IntPtr)
Declaration
public PageAddedEventHandler(object object, IntPtr method)
Parameters
Type |
Name |
Description |
System.Object |
object |
|
System.IntPtr |
method |
|
Methods
BeginInvoke(Object, PageAddedEventArgs, AsyncCallback, Object)
Declaration
public virtual IAsyncResult BeginInvoke(object sender, PageAddedEventArgs args, AsyncCallback callback, object object)
Parameters
Type |
Name |
Description |
System.Object |
sender |
|
PageAddedEventArgs |
args |
|
System.AsyncCallback |
callback |
|
System.Object |
object |
|
Returns
EndInvoke(IAsyncResult)
Declaration
public virtual void EndInvoke(IAsyncResult result)
Parameters
Type |
Name |
Description |
System.IAsyncResult |
result |
|
Invoke(Object, PageAddedEventArgs)
Declaration
public virtual void Invoke(object sender, PageAddedEventArgs args)
Parameters
See Also