Allows to set a page size for an output document.

Namespace:  SautinSoft
Assembly:  SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 7.1.4.17

Syntax

      
 C#  Visual Basic 
public class CPageSize
Public Class CPageSize

Members

         
 All Members  Properties   Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
A0()()()
841 x 1189 mm.
A1()()()
594 x 841 mm.
A2()()()
420 x 594 mm.
A3()()()
297 x 420 mm.
A4()()()
210 x 297 mm.
A5()()()
148 x 210 mm.
A6()()()
105 x 148 mm.
A7()()()
1000 x 1414 mm.
Auto()()()
Set the default page size: Letter.
B0()()()
707 x 1000 mm.
B1()()()
500 x 707 mm.
B2()()()
353 x 500 mm.
B3()()()
250 x 353 mm.
B4()()()
176 x 250 mm.
B5()()()
125 x 176 mm.
B6()()()
128 x 182 mm.
B7()()()
917 x 1297 mm.
C0()()()
648 x 917 mm.
C1()()()
458 x 648 mm.
C2()()()
324 x 458 mm.
C3()()()
229 x 324 mm.
C4()()()
162 x 229 mm.
C5()()()
114 x 162 mm.
C6()()()
81 x 114 mm.
C7()()()
216 x 279 mm.
EnvelopeC5()()()
162 x 229 mm.
EnvelopeC6()()()
114 x 162 mm.
EnvelopeDL()()()
110 x 220 mm.
Executive()()()
190 x 254 mm.
Height
Get and set the Page Height in Inches or millimeters.
LedgerTabloid()()()
279 x 432 mm.
Legal()()()
216 x 356 mm.
Letter()()()
216 x 279 mm.
Paper11x17()()()
279 x 432 mm.
Width
Get and set the Page Width in Inches or millimeters.

Remarks



Examples

CopyHow to set page size and margins using C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            // Set page size A5; margins: top, bottom 30 mm and left, right to 50 mm.
            // If you need more information about "HTML to RTF .Net" email us at:
            // support@sautinsoft.com        
            ConvertHtmlToDocxFile();
        }

        public static void ConvertHtmlToDocxFile()
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

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

            string inputFile = @"..\..\sample.html";
            string outputFile = Path.ChangeExtension(inputFile, ".docx");

            // Set page size and page margins.
            h.PageStyle.PageSize.A5();
            h.PageStyle.PageMarginTop.Mm(30);
            h.PageStyle.PageMarginBottom.Mm(30);
            h.PageStyle.PageMarginLeft.Mm(50);
            h.PageStyle.PageMarginRight.Mm(50);

            if (h.OpenHtml(inputFile))
            {
                bool ok = h.ToDocx(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile) { UseShellExecute = true });
            }
        }
    }
}
CopyHow to set page size and margins using VB.Net
Imports System
Imports System.IO
Imports System.Text

Module Module1
    Sub Main()
        ' Set page size A5; margins: top, bottom 30 mm and left, right to 50 mm.
        ' If you need more information about "HTML to RTF .Net" email us at:
        ' support@sautinsoft.com        
        ConvertHtmlToDocxFile()
    End Sub

    Public Sub ConvertHtmlToDocxFile()
        Dim h As New SautinSoft.HtmlToRtf()

        ' After purchasing the license, please insert your serial number here to activate the component.
        'h.Serial = "XXXXXXXXX"


        Dim inputFile As String = "..\sample.html"
        Dim outputFile As String = Path.ChangeExtension(inputFile, ".docx")

        ' Set page size and page margins.
        h.PageStyle.PageSize.A5()
        h.PageStyle.PageMarginTop.Mm(30)
        h.PageStyle.PageMarginBottom.Mm(30)
        h.PageStyle.PageMarginLeft.Mm(50)
        h.PageStyle.PageMarginRight.Mm(50)

        If h.OpenHtml(inputFile) Then
            Dim ok As Boolean = h.ToDocx(outputFile)

            ' Open the result for demonstration purposes.
            If ok Then
                System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outputFile) With {.UseShellExecute = True})
            End If
        End If
    End Sub
End Module

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.HtmlToRtf..::.CPageStyle..::.CPageSize

See Also