This sample shows how to create and use PdfDocument.InitialView property.

You can use InitialView property to setup a document view to be displayed by a PDF viewer application when document is opened. A document view specifies a page, its location and zoom level.

The InitialView property is null by default (which means that default view is to be used). You can create a document view (PdfDocumentView class) using PdfDocument.CreateView(..) method. After a document view is created, you can use methods and properties of PdfDocumentView class to setup that view.

C#
using System.Diagnostics;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class InitialView
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            useFitHeight();
            usePercentZoom();
        }

        private static void useFitHeight()
        {
            using (PdfDocument pdf = new PdfDocument())
            {
                pdf.InitialView = pdf.CreateView(0);
                pdf.InitialView.SetFitHeight();

                pdf.Save("FitHeight.pdf");
            }

            Process.Start("FitHeight.pdf");
        }

        private static void usePercentZoom()
        {
            using (PdfDocument pdf = new PdfDocument("Sample data/form.pdf"))
            {
                pdf.InitialView = pdf.CreateView(0);
                pdf.InitialView.SetZoom(40);

                pdf.Save("Percent.pdf");
            }

            Process.Start("Percent.pdf");
        }
    }
}
VB
Imports System.Diagnostics

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class InitialView
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            useFitHeight()
            usePercentZoom()
        End Sub

        Private Shared Sub useFitHeight()
            Using pdf As New PdfDocument()

                pdf.InitialView = pdf.CreateView(0)
                pdf.InitialView.SetFitHeight()

                pdf.Save("FitHeight.pdf")
            End Using

            Process.Start("FitHeight.pdf")
        End Sub

        Private Shared Sub usePercentZoom()
            Using pdf As New PdfDocument("Sample data/form.pdf")

                pdf.InitialView = pdf.CreateView(0)
                pdf.InitialView.SetZoom(40)

                pdf.Save("Percent.pdf")
            End Using

            Process.Start("Percent.pdf")
        End Sub
    End Class
End Namespace