Set page size of produced PDF document.

Namespace:  SautinSoft
Assembly:  PdfMetamorphosis (in PdfMetamorphosis.dll) Version: 6.7.12.19

Syntax

      
 C#  Visual Basic 
public class PageSizes
Public Class PageSizes

Members

         
 All Members  Properties   Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
A3()()()
Set A3 page size, 297 x 420 mm, 11.69 x 16.54 In.
A4()()()
Set A4 page size, 210 x 297 mm, 8.26 x 11.69 In.
A5()()()
Set A5 page size, 148 x 210 mm, 5.82 x 8.26 In.
A6()()()
Set A6 page size, 105 x 148 mm, 4.13 x 5.82 In.
Auto()()()
Use default page size.
B5Iso()()()
Set B5Iso page size, 176 x 250 mm, 6.93 x 9.83 In.
B5Jis()()()
Set B5Jis page size, 182 x 257 mm, 7.16 x 10.11 In.
B6()()()
Set B6 page size, 128 x 182 mm, 5.04 x 7.16 In.
Executive()()()
Set Executive page size, 184 x 267 mm, 7.25 x 10.5 In.
Folio()()()
Set Folio page size, 210 x 330 mm, 8.26 x 12.99 In.
Height
Set a custom page height in inches, px or mm.
Legal()()()
Set Legal page size, 216 x 356 mm, 8.5 x 14 In.
Letter()()()
Set Letter size, 216 x 279 mm, 8.5 x 11 In.
Oficio2()()()
Set Oficio2 page size, 216 x 330 mm, 8.5 x 13 In
Statement()()()
Set Statement page size, 140 x 216 mm, 5.5 x 8.5 In.
Width
Set a custom page width in inches, px or mm.

Examples

CopyHow to set page size, orientation and margins in C#
using System;
using System.IO;
using System.Collections;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            //How to set page size, orientation and margins
            SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();

            //After purchasing the license, please insert your serial number here to activate the component
            //p.Serial = "XXXXXXXXXXX";

            //Let's set: A3, Landscape orientation, left and right margins: 1.5 Inch, top and bottom: 1 Inch
            p.PageSettings.Size.A3();
            p.PageSettings.Orientation = SautinSoft.PdfMetamorphosis.PageSetting.Orientations.Landscape;
            p.PageSettings.MarginLeft.Inch(1.5f);
            p.PageSettings.MarginRight.Inch(1.5f);
            p.PageSettings.MarginTop.Inch(1.0f);
            p.PageSettings.MarginBottom.Inch(1.0f);

            if (p != null)
            {
                string rtfPath = @"..\..\..\..\..\test.rtf";
                string pdfPath = @"..\..\..\..\..\test.pdf";

                int i = p.RtfToPdfConvertFile(rtfPath,pdfPath);

                if (i !=0)
                {
                    System.Console.WriteLine("An error occured during converting RTF to PDF!");
                }
                else
                {
                    System.Diagnostics.Process.Start(pdfPath);
                }
            }
        }
    }
}
CopyHow to set page size, orientation and margins in VB.Net
Imports System
Imports System.IO
Imports System.Text

Module sample

    Sub Main()
        'How to set page size, orientation and margins
        Dim p As New SautinSoft.PdfMetamorphosis()

        'After purchasing the license, please insert your serial number here to activate the component
        'p.Serial = "XXXXXXXXXXX";


        'Let's set: A3, Landscape orientation, left and right margins: 1.5 Inch, top and bottom: 1 Inch
        p.PageSettings.Size.A3()
        p.PageSettings.Orientation = SautinSoft.PdfMetamorphosis.PageSetting.Orientations.Landscape
        p.PageSettings.MarginLeft.Inch(1.5F)
        p.PageSettings.MarginRight.Inch(1.5F)
        p.PageSettings.MarginTop.Inch(1.0F)
        p.PageSettings.MarginBottom.Inch(1.0F)

        If p IsNot Nothing Then
            Dim rtfPath As String = "..\..\..\..\..\test.rtf"
            Dim pdfPath As String = "..\..\..\..\..\test.pdf"

            Dim i As Integer = p.RtfToPdfConvertFile(rtfPath, pdfPath)

            If i <> 0 Then
                System.Console.WriteLine("An error occured during converting RTF to PDF!")
            Else
                System.Diagnostics.Process.Start(pdfPath)
            End If
        End If
    End Sub
End Module

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.PdfMetamorphosis..::.PageSetting..::.PageSizes

See Also