Click or drag to resize

UseOfficeCPageStyleCPageSize Class

Allows to set page size for output PDF document
Inheritance Hierarchy
SystemObject
  SautinSoftUseOfficeCPageStyleCPageSize

Namespace: SautinSoft
Assembly: UseOffice (in UseOffice.dll) Version: 2023.11.14
Syntax
public class CPageSize

The UseOfficeCPageStyleCPageSize type exposes the following members.

Constructors
 NameDescription
Public methodUseOfficeCPageStyleCPageSize Creates an instance of UseOfficeCPageStyleCPageSize
Top
Properties
 NameDescription
Public propertyHeightInch Sets the page height in inches. (Doesn't acceptable for Excel documents).
Public propertyHeightMm Sets the page height in millimeters. (Doesn't acceptable for Excel documents).
Public propertyWidthInch Sets the page width in inches. (Doesn't acceptable for Excel documents).
Public propertyWidthMm Sets the page width in millimeters. (Doesn't acceptable for Excel documents).
Top
Methods
 NameDescription
Public methodA3 Set A3 page size, 297 x 420 mm, 11.69 x 16.54 In
Public methodA4 Set A4 page size, 210 x 297 mm, 8.26 x 11.69 In
Public methodA5 Set A5 page size, 148 x 210 mm, 5.82 x 8.26 In
Public methodA6 Set A6 page size, 105 x 148 mm, 4.13 x 5.82 In
Public methodCode exampleAuto Set default page size
Public methodB5Iso Set B5Iso page size, 176 x 250 mm, 6.93 x 9.83 In
Public methodB5Jis Set B5Jis page size, 182 x 257 mm, 7.16 x 10.11 In
Public methodB6 Set B6 page size, 128 x 182 mm, 5.04 x 7.16 In
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodExecutive Set Executive page size, 184 x 267 mm, 7.25 x 10.5 In
Public methodFolio Set Folio page size, 210 x 330 mm, 8.26 x 12.99 In
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodLegal Set Legal page size, 216 x 356 mm, 8.5 x 14 In
Public methodLetter Set Letter size, 216 x 279 mm, 8.5 x 11 In
Public methodOficio2 Set Oficio2 page size, 216 x 330 mm, 8.5 x 13 In
Public methodStatement Set Statement page size, 140 x 216 mm, 5.5 x 8.5 In
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodxlPaper10x14 10 in. x 14 in. Acceptable only for Excel documents.
Public methodxlPaper11x17 11 in. x 17 in. Acceptable only for Excel documents.
Public methodxlPaperA3 A3 (297 mm x 420 mm). Acceptable only for Excel documents.
Public methodxlPaperA4 A4 (210 mm x 297 mm). Acceptable only for Excel documents.
Public methodxlPaperA4Small A4 Small (210 mm x 297 mm). Acceptable only for Excel documents.
Public methodxlPaperA5 A5 (148 mm x 210 mm). Acceptable only for Excel documents.
Public methodxlPaperB4 B4 (250 mm x 354 mm). Acceptable only for Excel documents.
Public methodxlPaperB5 B5 (182 mm x 257 mm). Acceptable only for Excel documents.
Public methodxlPaperDsheet C size sheet (176 mm x 250 mm). Acceptable only for Excel documents.
Top
Example
How 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(@"..\..\..\..\..\..\TestFiles\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.");
        }

    }
}
How 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("..\..\..\..\..\..\TestFiles\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
See Also