Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfPageSettings

    Show / Hide Table of Contents

    Class PdfPageSettings

    The class provides various setting related with PDF pages

    Inheritance
    System.Object
    PdfPageSettings
    Implements
    ICloneable
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfPageSettings : Object, ICloneable
    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.

    Declaration
    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF)

    Initializes a new instance of the PdfPageSettings class with size.

    Declaration
    public PdfPageSettings(SizeF size)
    Parameters
    Type Name Description
    SizeF size

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF, PdfPageOrientation)

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

    Declaration
    public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation)
    Parameters
    Type Name Description
    SizeF size

    The size.

    PdfPageOrientation pageOrientation

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF, PdfPageOrientation, Single)

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

    Declaration
    public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation, float margins)
    Parameters
    Type Name Description
    SizeF size

    The size.

    PdfPageOrientation pageOrientation

    The page orientation.

    System.Single margins

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF, PdfPageOrientation, Single, Single, Single, Single)

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

    Declaration
    public PdfPageSettings(SizeF size, PdfPageOrientation pageOrientation, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
    Parameters
    Type Name Description
    SizeF size

    The size.

    PdfPageOrientation pageOrientation

    The page orientation.

    System.Single leftMargin

    The left margin.

    System.Single topMargin

    The top margin.

    System.Single rightMargin

    The right margin.

    System.Single bottomMargin

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF, Single)

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

    Declaration
    public PdfPageSettings(SizeF size, float margins)
    Parameters
    Type Name Description
    SizeF size

    The size of the page.

    System.Single margins

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(SizeF, Single, Single, Single, Single)

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

    Declaration
    public PdfPageSettings(SizeF size, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
    Parameters
    Type Name Description
    SizeF size

    The size.

    System.Single leftMargin

    The left margin.

    System.Single topMargin

    The top margin.

    System.Single rightMargin

    The right margin.

    System.Single bottomMargin

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(PdfPageOrientation)

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

    Declaration
    public PdfPageSettings(PdfPageOrientation pageOrientation)
    Parameters
    Type Name Description
    PdfPageOrientation pageOrientation

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(Single)

    Initializes a new instance of the PdfPageSettings class with margins.

    Declaration
    public PdfPageSettings(float margins)
    Parameters
    Type Name Description
    System.Single margins

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    PdfPageSettings(Single, Single, Single, Single)

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

    Declaration
    public PdfPageSettings(float leftMargin, float topMargin, float rightMargin, float bottomMargin)
    Parameters
    Type Name Description
    System.Single leftMargin

    The left margin.

    System.Single topMargin

    The top margin.

    System.Single rightMargin

    The right margin.

    System.Single bottomMargin

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Properties

    Height

    Gets or sets the height of the page.

    Declaration
    public float Height { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    Default value: 842 pixels

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

    Margins

    Gets or sets the margins of the page.

    Declaration
    public PdfMargins Margins { get; set; }
    Property Value
    Type Description
    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
    PdfDocument

    Orientation

    Gets or sets the page orientation.

    Declaration
    public PdfPageOrientation Orientation { get; set; }
    Property Value
    Type Description
    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
    PdfDocument

    Rotate

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

    Declaration
    public PdfPageRotateAngle Rotate { get; set; }
    Property Value
    Type Description
    PdfPageRotateAngle

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

    Remarks

    Default value: RotateAngle0

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

    Size

    Gets or sets the size of the page.

    Declaration
    public SizeF Size { get; set; }
    Property Value
    Type Description
    SizeF
    Remarks

    Default value: 595 * 842 pixels

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

    Transition

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

    Declaration
    public PdfPageTransition Transition { get; set; }
    Property Value
    Type Description
    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
    PdfDocument

    Width

    Gets or sets the width of the page.

    Declaration
    public float Width { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    Default value: 595 pixels

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

    Methods

    Clone()

    Creates a clone of the object.

    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

    Cloned object.

    SetMargins(Single)

    Sets the margins to the page.

    Declaration
    public void SetMargins(float margins)
    Parameters
    Type Name Description
    System.Single margins

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    SetMargins(Single, Single)

    Sets the left right and top bottom margins.

    Declaration
    public void SetMargins(float leftRight, float topBottom)
    Parameters
    Type Name Description
    System.Single leftRight

    The left right margin.

    System.Single topBottom

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    SetMargins(Single, Single, Single, Single)

    Sets the left,top,right,bottom margins.

    Declaration
    public void SetMargins(float left, float top, float right, float bottom)
    Parameters
    Type Name Description
    System.Single left

    The left margin.

    System.Single top

    The top margin.

    System.Single right

    The right margin.

    System.Single bottom

    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
    PdfDocument
    PdfPage
    PdfFont
    PdfBrush

    Implements

    ICloneable

    See Also

    PdfDocument
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved