Table of Contents

Class PdfPageSettings

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

The class provides various setting related with PDF pages

public class PdfPageSettings : ICloneable
Inheritance
PdfPageSettings
Implements
Inherited Members

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page settings.
doc.PageSettings.Orientation = PdfPageOrientation.Landscape;
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180;
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page settings
doc.PageSettings.Orientation = PdfPageOrientation.Landscape
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)

Constructors

PdfPageSettings()

Initializes a new instance of the PdfPageSettings class.

public PdfPageSettings()

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for document margin.
PdfMargins margin = new PdfMargins();
margin.All = 20;
//Create new instance for page settings.
PdfPageSettings setting = new PdfPageSettings();
//Set document margin.
setting.Margins = margin;
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for document margin.
Dim margin As PdfMargins = New PdfMargins()
margin.All = 20
'Create new instance for page settings.
Dim setting As PdfPageSettings = New PdfPageSettings()
'Set document margin.
setting.Margins = margin
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF)

Initializes a new instance of the PdfPageSettings class with size.

public PdfPageSettings(SizeF size)

Parameters

size SizeF

The size.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for document margin.
PdfMargins margin = new PdfMargins();
margin.All = 20;
//Create new instance for page settings with predefined page size.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300,300));
//Set document margin.
setting.Margins = margin;
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for document margin.
Dim margin As PdfMargins = New PdfMargins()
margin.All = 20
'Create new instance for page settings with predefined page size.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 300))
'Set document margin.
setting.Margins = margin
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF, PdfPageOrientation)

Initializes a new instance of the PdfPageSettings class with size and page orientation.

public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation)

Parameters

size SizeF

The size.

pageOrientation PdfPageOrientation

The page orientation.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for document margin.
PdfMargins margin = new PdfMargins();
margin.All = 20;
//Create new instance for page settings with predefined page orientation.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300, 600), PdfPageOrientation.Landscape);
//Set document margin.
setting.Margins = margin;
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for document margin.
Dim margin As PdfMargins = New PdfMargins()
margin.All = 20
'Create new instance for page settings with predefined page size and orientation.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 600), PdfPageOrientation.Landscape)
'Set document margin.
setting.Margins = margin
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF, PdfPageOrientation, float)

Initializes a new instance of the PdfPageSettings class with size,page orientation,margins

public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation, float margins)

Parameters

size SizeF

The size.

pageOrientation PdfPageOrientation

The page orientation.

margins float

The margins.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with predefined page size , orientation and margin value.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300, 600), PdfPageOrientation.Landscape, 20f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with predefined page size , orientation and margin value.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 600), PdfPageOrientation.Landscape,20F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF, PdfPageOrientation, float, float, float, float)

Initializes a new instance of the PdfPageSettings class with size page orientation,left,top,right,bottom margins.

public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation, float leftMargin, float topMargin, float rightMargin, float bottomMargin)

Parameters

size SizeF

The size.

pageOrientation PdfPageOrientation

The page orientation.

leftMargin float

The left margin.

topMargin float

The top margin.

rightMargin float

The right margin.

bottomMargin float

The bottom margin.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with predefined page size , orientation and left,top,right,bottom margins.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300, 600), PdfPageOrientation.Landscape, 20f, 50f, 20f, 50f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with predefined page size , orientation and left,top,right,bottom margins.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 600), PdfPageOrientation.Landscape,20F, 50F, 20F, 50F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF, float)

Initializes a new instance of the PdfPageSettings class with size and margins

public PdfPageSettings(SizeF size, float margins)

Parameters

size SizeF

The size of the page.

margins float

The margins.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with predefined page size and margin value.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300, 600),20f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with predefined page size and margin value.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 600), 20F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(SizeF, float, float, float, float)

Initializes a new instance of the PdfPageSettings class with size left,top,right,bottom margins.

public PdfPageSettings(SizeF size, float leftMargin, float topMargin, float rightMargin, float bottomMargin)

Parameters

size SizeF

The size.

leftMargin float

The left margin.

topMargin float

The top margin.

rightMargin float

The right margin.

bottomMargin float

The bottom margin.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with predefined page size and margin value.
PdfPageSettings setting = new PdfPageSettings(new SizeF(300, 600), 20f, 50f, 20f, 50f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with predefined page size and margin value.
Dim setting As PdfPageSettings = New PdfPageSettings(New SizeF(300, 600), 20F, 50F, 20F, 50F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(PdfPageOrientation)

Initializes a new instance of the PdfPageSettings class with page orientation.

public PdfPageSettings(PdfPageOrientation pageOrientation)

Parameters

pageOrientation PdfPageOrientation

The PdfPageOrientation.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for document margin.
PdfMargins margin = new PdfMargins();
margin.All = 20;
//Create new instance for page settings with predefined page orientation.
PdfPageSettings setting = new PdfPageSettings(PdfPageOrientation.Landscape);
//Set document margin.
setting.Margins = margin;
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for document margin.
Dim margin As PdfMargins = New PdfMargins()
margin.All = 20
'Create new instance for page settings with predefined page orientation.
Dim setting As PdfPageSettings = New PdfPageSettings(PdfPageOrientation.Landscape)
'Set document margin.
setting.Margins = margin
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(float)

Initializes a new instance of the PdfPageSettings class with margins.

public PdfPageSettings(float margins)

Parameters

margins float

The margins.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with margin value.
PdfPageSettings setting = new PdfPageSettings(50f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with predefined margin value.
Dim setting As PdfPageSettings = New PdfPageSettings(50F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

PdfPageSettings(float, float, float, float)

Initializes a new instance of the PdfPageSettings class with left margin,top margin,right margin.

public PdfPageSettings(float leftMargin, float topMargin, float rightMargin, float bottomMargin)

Parameters

leftMargin float

The left margin.

topMargin float

The top margin.

rightMargin float

The right margin.

bottomMargin float

The bottom margin.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for page settings with left margin,top margin,right margin.
PdfPageSettings setting = new PdfPageSettings(20f, 50f, 20f, 50f);
doc.PageSettings = setting;
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for page settings with left margin,top margin,right margin.
Dim setting As PdfPageSettings = New PdfPageSettings(20F, 50F, 20F, 50F)
doc.PageSettings = setting
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

Properties

Height

Gets or sets the height of the page.

public float Height { get; set; }

Property Value

float

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page size.
doc.PageSettings.Height = 300;
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page size
doc.PageSettings.Height = 300
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)

Remarks

Default value: 842 Points

See Also

Margins

Gets or sets the margins of the page.

public PdfMargins Margins { get; set; }

Property Value

PdfMargins

The PdfMargins, provides margins to the PDF page

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create new instance for document margin.
PdfMargins margin = new PdfMargins();
margin.All = 20;
//Set document margin.
doc.PageSettings.Margins = margin
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create new instance for document margin.
Dim margin As PdfMargins = New PdfMargins()
margin.All = 20
'Set document margin.
doc.PageSettings.Margins = margin
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

Orientation

Gets or sets the page orientation.

public PdfPageOrientation Orientation { get; set; }

Property Value

PdfPageOrientation

The PdfPageOrientation, provides the orientation of the PDF page

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page settings.
doc.PageSettings.Orientation = PdfPageOrientation.Landscape;
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180;
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page settings
doc.PageSettings.Orientation = PdfPageOrientation.Landscape
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)
See Also

Rotate

Gets or sets the number of degrees by which the page should be rotated clockwise when displayed or printed.

public PdfPageRotateAngle Rotate { get; set; }

Property Value

PdfPageRotateAngle

The PdfPageRotateAngle,provides number of degrees by which the page should be rotated clockwise when displayed or printed

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page settings.
doc.PageSettings.Orientation = PdfPageOrientation.Landscape;
//Set rotation angle.
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180;
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page settings
doc.PageSettings.Orientation = PdfPageOrientation.Landscape
'Set rotation angle
doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle180
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)

Remarks

Default value: RotateAngle0

See Also

Size

Gets or sets the size of the page.

public SizeF Size { get; set; }

Property Value

SizeF

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page size.
doc.PageSettings.Size = new SizeF(600, 600);
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page size
doc.PageSettings.Size = New SizeF(600, 600)
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)

Remarks

Default value: 595 * 842 Points

See Also

Transition

Gets or sets the transition, it determines how to display the page in the presentation mode

public PdfPageTransition Transition { get; set; }

Property Value

PdfPageTransition

The PdfPageTransition determines how to display the page in the presentation mode.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
doc.ViewerPreferences.PageMode = PdfPageMode.FullScreen;
//create a page transition.
PdfPageTransition transition = new PdfPageTransition();
transition.Direction = PdfTransitionDirection.TopLeftToBottomRight;
transition.Dimension = PdfTransitionDimension.Vertical;
transition.Motion = PdfTransitionMotion.Outward;
transition.PageDuration = 3;
//Set page transition.
doc.PageSettings.Transition = transition;
//Create a new page
PdfPage page = doc.Pages.Add();
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
doc.ViewerPreferences.PageMode = PdfPageMode.FullScreen
'create a page transition.
Dim transition As PdfPageTransition = New PdfPageTransition()
transition.Direction = PdfTransitionDirection.TopLeftToBottomRight
transition.Dimension = PdfTransitionDimension.Vertical
transition.Motion = PdfTransitionMotion.Outward
transition.PageDuration = 3
'Set page transition.
doc.PageSettings.Transition = transition
Dim page As PdfPage = doc.Pages.Add()
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

Width

Gets or sets the width of the page.

public float Width { get; set; }

Property Value

float

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set page width.
doc.PageSettings.Width = 300;
//Create a new page.
PdfPage page = doc.Pages.Add();
doc.Save("output.pdf");
doc.Close(true);
'Create a new document
Dim doc As New PdfDocument()
'Set page width
doc.PageSettings.Width = 300
'Create a new page
Dim page As PdfPage = doc.Pages.Add()
doc.Save("output.pdf")
doc.Close(True)

Remarks

Default value: 595 Points

See Also

Methods

Clone()

Creates a clone of the object.

public object Clone()

Returns

object

Cloned object.

See Also

SetMargins(float)

Sets the margins to the page.

public void SetMargins(float margins)

Parameters

margins float

The margins.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set margins for pdf document.
doc.PageSettings.SetMargins(10);
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Set margins for pdf document.
doc.PageSettings.SetMargins(10)
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

SetMargins(float, float)

Sets the left right and top bottom margins.

public void SetMargins(float leftRight, float topBottom)

Parameters

leftRight float

The left right margin.

topBottom float

The top bottom margin.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set margins for pdf document.
doc.PageSettings.SetMargins(10, 10);
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Set margins for pdf document.
doc.PageSettings.SetMargins(10, 10)
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

SetMargins(float, float, float, float)

Sets the left,top,right,bottom margins.

public void SetMargins(float left, float top, float right, float bottom)

Parameters

left float

The left margin.

top float

The top margin.

right float

The right margin.

bottom float

The bottom margin.

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Set margins for pdf document.
doc.PageSettings.SetMargins(10, 10, 10, 10);
//Create a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12);
//Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, new PointF(100, 100));
//Save and close the document.
doc.Save("Output.pdf");
doc.Close(true);
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Set margins for pdf document.
doc.PageSettings.SetMargins(10, 10, 10, 10)
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12)
'Draw the text.
page.Graphics.DrawString("Hello world", font, PdfBrushes.Blue, New PointF(100, 100))
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)
See Also

See Also