Table of Contents

Class PdfPage

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Provides methods and properties to create PDF pages and its elements, PdfPage class inherited from the PdfPageBase class

public class PdfPage : PdfPageBase
Inheritance
PdfPage
Inherited Members

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)</code></pre>

Constructors

PdfPage()

Initializes a new instance of the PdfPage class.

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)</code></pre>
See Also

Properties

Annotations

Gets a collection of the annotations of the page- Read only.

public PdfAnnotationCollection Annotations { get; }

Property Value

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)
See Also

Section

Gets the section of a page- Read only

public PdfSection Section { get; }

Property Value

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

PdfException

Page must be added to some section before using.

See Also

Size

Gets size of the PDF page- Read only

public override SizeF Size { get; }

Property Value

SizeF

A SizeF that represents the size 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 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.

public SizeF GetClientSize()

Returns

SizeF

Type: System.Drawing.SizeF

The actual page size reduced by page margins and page template dimensions

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)

Remarks

It's the actual size of the page where some output can be performed.

See Also

OnBeginSave(EventArgs)

Raises BeginSave event.

protected virtual void OnBeginSave(EventArgs e)

Parameters

e EventArgs

Event arguments.

See Also

Events

BeginSave

Raises before the page saves.

public event EventHandler BeginSave

Event Type

EventHandler
See Also

See Also