Allows to set scale produced document. Default value: FitByWidth().

Namespace:  SautinSoft
Assembly:  SautinSoft.ExcelToPdf (in SautinSoft.ExcelToPdf.dll) Version: 4.2.7.24

Syntax

      
 C#  Visual Basic 
public class CPageScale
Public Class CPageScale

Members

      
 All Members  Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
Auto()()()
Convert without any scalling.
FitByHeight()()()
Fit each Excel sheet to a one PDF page depending of the page height. Thus, either to decrease the scale or leave as is if sheet could be fitted by page height.
FitByWidth()()()
Fit each Excel sheet to a one PDF page depending of the page width. Thus, either to decrease the scale or leave as is if sheet could be fitted by page width.
Percent(Int32)
Allows to specify page scale in percentages: from 1...10000.
ScaleByHeight()()()
Make the scale the same as PDF page height. Thus, either to decrease or to increase scale.
ScaleByWidth()()()
Make the scale the same as PDF page width. Thus, either to decrease or to increase scale.
ScaleToOnePage()()()
Make the scale close as possible to page size to fit the sheet into a single page. Simultaneously takes care of page width and height.

Examples

CopyFit each sheet to a single PDF page fixed size in C#
using System;
using System.IO;
using SautinSoft;

namespace Sample
{
    class Sample
    {
        static void Main(string[] args)
        {
            // Fit each sheet to a single page fixed size
            ExcelToPdf x = new ExcelToPdf();

            //Fit each sheet to single PDF page, A4 format.
            x.PageStyle.PageSize.A4();
            x.PageStyle.PageScale.Auto();

            // Set PDF as output format.
            x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf;


            string excelFile = Path.GetFullPath(@"..\..\..\..\test.xlsx");
            string pdfFile = Path.ChangeExtension(excelFile, ".pdf"); ;

            try
            {
                x.ConvertFile(excelFile, pdfFile);
                System.Diagnostics.Process.Start(pdfFile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }

        }
    }
}
CopyFit each sheet to single a PDF page fixed size in VB.Net
Imports System
Imports System.IO
Imports SautinSoft

Module Sample

    Sub Main()
        ' Fit each sheet to a single page fixed size
        Dim x As New ExcelToPdf()

        'Fit each sheet to single PDF page, A4 format.
        x.PageStyle.PageSize.A4()
        x.PageStyle.PageScale.Auto()

        ' Set PDF as output format.
        x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf


        Dim excelFile As String = Path.GetFullPath("..\..\..\test.xlsx")
        Dim pdfFile As String = Path.ChangeExtension(excelFile, ".pdf")


        Try
            x.ConvertFile(excelFile, pdfFile)
            System.Diagnostics.Process.Start(pdfFile)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
            Console.ReadLine()
        End Try

    End Sub
End Module

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.ExcelToPdf..::.CPageStyle..::.CPageScale

See Also