Allows to set page size for output PDF document

Namespace:  SautinSoft
Assembly:  UseOffice (in UseOffice.dll) Version: 4.9.1.1

Syntax

      
 C#  Visual Basic 
public class CPageSize
Public Class CPageSize

Members

            
 All Members  Constructors   Properties   Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
UseOffice..::.CPageStyle..::.CPageSize()()()
Creates an instance of UseOffice..::.CPageStyle..::.CPageSize
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()()()
Set 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
HeightInch
Sets the page height in inches. (Doesn't acceptable for Excel documents).
HeightMm
Sets the page height in millimeters. (Doesn't acceptable for Excel documents).
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
WidthInch
Sets the page width in inches. (Doesn't acceptable for Excel documents).
WidthMm
Sets the page width in millimeters. (Doesn't acceptable for Excel documents).
xlPaper10x14()()()
10 in. x 14 in. Acceptable only for Excel documents.
xlPaper11x17()()()
11 in. x 17 in. Acceptable only for Excel documents.
xlPaperA3()()()
A3 (297 mm x 420 mm). Acceptable only for Excel documents.
xlPaperA4()()()
A4 (210 mm x 297 mm). Acceptable only for Excel documents.
xlPaperA4Small()()()
A4 Small (210 mm x 297 mm). Acceptable only for Excel documents.
xlPaperA5()()()
A5 (148 mm x 210 mm). Acceptable only for Excel documents.
xlPaperB4()()()
B4 (250 mm x 354 mm). Acceptable only for Excel documents.
xlPaperB5()()()
B5 (182 mm x 257 mm). Acceptable only for Excel documents.
xlPaperDsheet()()()
C size sheet (176 mm x 250 mm). Acceptable only for Excel documents.

Remarks



Examples

CopyHow to convert a HTML file to a PDF file in C#
using System;
using System.IO;
using System.Collections;

namespace Sample
{
    class Test
    {
        static void Main(string[] args)
        {
            // Convert HTML file to PDF file.
            // If you need more information about UseOffice .Net email us at:
            // support@sautinsoft.com.

            SautinSoft.UseOffice u = new SautinSoft.UseOffice();

            string inpFile = Path.GetFullPath(@"..\..\..\..\..\Testing files\example.html");
            string outFile = Path.GetFullPath("Result.pdf");

            // Prepare UseOffice .Net, loads MS Word in memory
            int ret = u.InitWord();

            // Return values:
            // 0 - Loading successfully
            // 1 - Can't load MS Word library in memory 

            if (ret == 1)
            {
                Console.WriteLine("Error! Can't load MS Word library in memory");
                return;
            }

            // Perform the conversion.
            ret = u.ConvertFile(inpFile, outFile, SautinSoft.UseOffice.eDirection.HTML_to_PDF);

            // Release MS Word from memory
            u.CloseWord();

            // 0 - Converting successfully
            // 1 - Can't open input file. Check that you are using full local path to input file, URL and relative path are not supported
            // 2 - Can't create output file. Please check that you have permissions to write by this path or probably this path already used by another application
            // 3 - Converting failed, please contact with our Support Team
            // 4 - MS Office isn't installed. The component requires that any of these versions of MS Office should be installed: 2000, XP, 2003, 2007, 2010, 2013, 2016 or 2019.
            if (ret == 0)
            {
                // Open the result.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
            }
            else
                Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.");
        }

    }
}
CopyHow to convert a HTML file to a PDF file in VB.Net
Imports System
Imports System.IO
Imports System.Collections

Namespace Sample
    Friend Class Test
        Shared Sub Main(ByVal args() As String)
            ' Convert HTML file to PDF file.
            ' If you need more information about UseOffice .Net email us at:
            ' support@sautinsoft.com.


            Dim u As New SautinSoft.UseOffice()

            Dim inpFile As String = Path.GetFullPath("..\..\..\..\Testing files\example.html")
            Dim outFile As String = Path.GetFullPath("Result.pdf")

            ' Prepare UseOffice .Net, loads MS Word in memory
            Dim ret As Integer = u.InitWord()

            ' Return values:
            ' 0 - Loading successfully
            ' 1 - Can't load MS Word library in memory 


            If ret = 1 Then
                Console.WriteLine("Error! Can't load MS Word library in memory")
                Return
            End If

            ' Perform the conversion.
            ret = u.ConvertFile(inpFile, outFile, SautinSoft.UseOffice.eDirection.HTML_to_PDF)

            ' Release MS Word from memory
            u.CloseWord()

            ' 0 - Converting successfully
            ' 1 - Can't open input file. Check that you are using full local path to input file, URL and relative path are not supported
            ' 2 - Can't create output file. Please check that you have permissions to write by this path or probably this path already used by another application
            ' 3 - Converting failed, please contact with our Support Team
            ' 4 - MS Office isn't installed. The component requires that any of these versions of MS Office should be installed: 2000, XP, 2003, 2007, 2010, 2013, 2016 or 2019.
            If ret = 0 Then
                ' Open the result.
                System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
            Else
                Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.")
            End If
        End Sub

    End Class
End Namespace

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.UseOffice..::.CPageStyle..::.CPageSize

See Also