Class PdfPage
Provides methods and properties to create PDF pages and its elements, PdfPage class inherited from the PdfPageBase class
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfPage : PdfPageBase, IPdfWrapper
Examples
The following example shows the several properties and methods of PdfPage class
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Get annotation collection
PdfAnnotationCollection annotation = page.Annotations;
//Get Graphics
PdfGraphics graphics = page.Graphics;
//Get page Layers
PdfPageLayerCollection layers = page.Layers;
//Get actual page size
SizeF clientSize = page.GetClientSize();
//Insert page in the document
document.Pages.Insert(0, page);
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Get annotation collection
Dim annotation As PdfAnnotationCollection = page.Annotations
'Get Graphics
Dim graphics As PdfGraphics = page.Graphics
'Get page Layers
Dim layers As PdfPageLayerCollection = page.Layers
'Get actual page size
Dim clientSize As SizeF = page.GetClientSize()
'Insert page in the document
document.Pages.Insert(0, page)
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
Constructors
PdfPage()
Initializes a new instance of the PdfPage class.
Declaration
public PdfPage()
Examples
The following code example demonstrates how to construct a PdfPage
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Insert page in the document
document.Pages.Insert(0, page);
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Insert page in the document
document.Pages.Insert(0, page)
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
Properties
Annotations
Gets a collection of the annotations of the page- Read only.
Declaration
public PdfAnnotationCollection Annotations { get; }
Property Value
Type | Description |
---|---|
PdfAnnotationCollection | A PdfAnnotationCollection that represents the annotations of the page. |
Examples
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Insert page in the document
document.Pages.Insert(0, page);
//Get annotation collection
PdfAnnotationCollection annotation = page.Annotations;
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Insert page in the document
document.Pages.Insert(0, page)
'Get annotation collection
Dim annotation As PdfAnnotationCollection = page.Annotations
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
Section
Gets the section of a page- Read only
Declaration
public PdfSection Section { get; }
Property Value
Type | Description |
---|---|
PdfSection | The PdfSection. |
Examples
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Insert page in the document
document.Pages.Insert(0, page);
//Get Section of a page
PdfSection section = page.Section;
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Insert page in the document
document.Pages.Insert(0, page)
'Get Section of a page
Dim section As PdfSection = page.Section
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
Exceptions
Type | Condition |
---|---|
PdfException | Page must be added to some section before using. |
See Also
Size
Gets size of the PDF page- Read only
Declaration
public override SizeF Size { get; }
Property Value
Type | Description |
---|---|
SizeF | A SizeF that represents the size of the page |
Overrides
Examples
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Insert page in the document
document.Pages.Insert(0, page);
//Get size of a page
SizeF size = page.Size;
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Insert page in the document
document.Pages.Insert(0, page)
'Get size of a page
Dim size As SizeF = page.Size
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
See Also
Methods
GetClientSize()
Get the PDF page size reduced by page margins and page template dimensions.
Declaration
public SizeF GetClientSize()
Returns
Type | Description |
---|---|
SizeF | Type: System.Drawing.SizeF The actual page size reduced by page margins and page template dimensions |
Remarks
It's the actual size of the page where some output can be performed.
Examples
//Create a PDF document
PdfDocument document = new PdfDocument();
//Create a page
PdfPage page = new PdfPage();
//Insert page in the document
document.Pages.Insert(0, page);
//Get size of the page
SizeF size = page.GetClientSize();
//Save and close the PDF document
document.Save("output.Pdf");
document.Close(true);
'Create a PDF document
Dim document As New PdfDocument()
'Create a page
Dim page As New PdfPage()
'Insert page in the document
document.Pages.Insert(0, page)
'Get size of the page
Dim size As SizeF = page.GetClientSize()
'Save and close the PDF document
document.Save("output.Pdf")
document.Close(True)
OnBeginSave(EventArgs)
Raises BeginSave event.
Declaration
protected virtual void OnBeginSave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event arguments. |
Events
BeginSave
Raises before the page saves.
Declaration
public event EventHandler BeginSave
Event Type
Type |
---|
System.EventHandler |