# pdfviewer-multi-tabbed-viewer

> Sample that hosts multiple PdfViewer instances inside a TabControl so users can open several PDFs side by side.

**Framework:** winforms  **Component:** PdfViewer  **Variant:** multi-tabbed-viewer

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/winforms/pdfviewer-multi-tabbed-viewer.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.PdfViewer.Windows
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/pdfviewer-multi-tabbed-viewer/pdfviewer.Designer.cs

```cs
using Syncfusion.Windows.Forms;
using System.Drawing;

namespace MultiTabbedViewer
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.Tooltip = new System.Windows.Forms.ToolTip(this.components);
            this.Tab1 = new Syncfusion.Windows.Forms.Tools.TabPageAdv();
            this.pdfDocumentView1 = new Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView();
            this.tabControlAdv1 = new Syncfusion.Windows.Forms.Tools.TabControlAdv();
            this.Tab2 = new Syncfusion.Windows.Forms.Tools.TabPageAdv();
            this.pdfDocumentView2 = new Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView();
            this.Tab3 = new Syncfusion.Windows.Forms.Tools.TabPageAdv();
            this.pdfDocumentView3 = new Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.btnPrint = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.btnGoToFirstPage = new System.Windows.Forms.ToolStripButton();
            this.btnGoToPreviousPage = new System.Windows.Forms.ToolStripButton();
            this.txtCurrentPageIndex = new System.Windows.Forms.ToolStripTextBox();
            this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
            this.lblTotalPageCount = new System.Windows.Forms.ToolStripLabel();
            this.btnGoToNextPage = new System.Windows.Forms.ToolStripButton();
            this.btnGoToLastPage = new System.Windows.Forms.ToolStripButton();
            this.toolStripButton3 = new System.Windows.Forms.ToolStripSeparator();
            this.btnZoomIn = new System.Windows.Forms.ToolStripButton();
            this.btnZoomOut = new System.Windows.Forms.ToolStripButton();
            this.cmbCurrentZoomLevel = new System.Windows.Forms.ToolStripComboBox();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
            this.FitPage = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
            this.FitWidth = new System.Windows.Forms.ToolStripButton();
            this.Tab1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.tabControlAdv1)).BeginInit();
            this.tabControlAdv1.SuspendLayout();
            this.Tab2.SuspendLayout();
            this.Tab3.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // Tab1
            //
            this.Tab1.Controls.Add(this.pdfDocumentView1);
            this.Tab1.Image = null;
            this.Tab1.ImageSize = new System.Drawing.Size(16, 16);
            this.Tab1.Location = new System.Drawing.Point(3, 33);
            this.Tab1.Name = "Tab1";
            this.Tab1.Size = new System.Drawing.Size(626, 324);
            this.Tab1.TabIndex = 1;
            this.Tab1.Text = "DataSheet.pdf";
            this.Tab1.ThemesEnabled = true;
            this.Tooltip.SetToolTip(this.Tab1, "hello");
            //
            // pdfDocumentView1
            //
            this.pdfDocumentView1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
            this.pdfDocumentView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pdfDocumentView1.Location = new System.Drawing.Point(0, 0);
            this.pdfDocumentView1.Name = "pdfDocumentView1";
            this.pdfDocumentView1.Size = new System.Drawing.Size(626, 324);
            this.pdfDocumentView1.TabIndex = 0;
            this.pdfDocumentView1.Text = "pdfDocumentView1";
            //
            // tabControlAdv1
            //
            this.tabControlAdv1.Controls.Add(this.Tab1);
            this.tabControlAdv1.Controls.Add(this.Tab2);
            this.tabControlAdv1.Controls.Add(this.Tab3);
            this.tabControlAdv1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tabControlAdv1.Location = new System.Drawing.Point(0, 25);
            this.tabControlAdv1.Name = "tabControlAdv1";
            this.tabControlAdv1.ShowTabCloseButton = true;
            this.tabControlAdv1.Size = new System.Drawing.Size(633, 361);
            this.tabControlAdv1.TabIndex = 3;
            this.tabControlAdv1.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.TabRendererVS2008);
            this.tabControlAdv1.ThemesEnabled = true;
            this.tabControlAdv1.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.tabControlAdv1_ControlRemoved);
            this.tabControlAdv1.Click += new System.EventHandler(this.tabControlAdv1_Click);
            //
            // Tab2
            //
            this.Tab2.Controls.Add(this.pdfDocumentView2);
            this.Tab2.Image = null;
            this.Tab2.ImageSize = new System.Drawing.Size(16, 16);
            this.Tab2.Location = new System.Drawing.Point(3, 33);
            this.Tab2.Name = "Tab2";
            this.Tab2.Size = new System.Drawing.Size(626, 324);
            this.Tab2.TabIndex = 2;
            this.Tab2.Text = "SimpleTable.pdf";
            this.Tab2.ThemesEnabled = true;
            //
            // pdfDocumentView2
            //
            this.pdfDocumentView2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
            this.pdfDocumentView2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pdfDocumentView2.Location = new System.Drawing.Point(0, 0);
            this.pdfDocumentView2.Name = "pdfDocumentView2";
            this.pdfDocumentView2.Size = new System.Drawing.Size(626, 324);
            this.pdfDocumentView2.TabIndex = 0;
            this.pdfDocumentView2.Text = "pdfDocumentView2";
            //
            // Tab3
            //
            this.Tab3.Controls.Add(this.pdfDocumentView3);
            this.Tab3.Image = null;
            this.Tab3.ImageSize = new System.Drawing.Size(16, 16);
            this.Tab3.Location = new System.Drawing.Point(3, 33);
            this.Tab3.Name = "Tab3";
            this.Tab3.Size = new System.Drawing.Size(626, 324);
            this.Tab3.TabIndex = 3;
            this.Tab3.Text = "EmpReport.pdf";
            this.Tab3.ThemesEnabled = true;
            //
            // pdfDocumentView3
            //
            this.pdfDocumentView3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
            this.pdfDocumentView3.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pdfDocumentView3.Location = new System.Drawing.Point(0, 0);
            this.pdfDocumentView3.Name = "pdfDocumentView3";
            this.pdfDocumentView3.Size = new System.Drawing.Size(626, 633);
            this.pdfDocumentView3.TabIndex = 0;
            this.pdfDocumentView3.Text = "pdfDocumentView3";
            //
            // toolStrip1
            //
            this.toolStrip1.ImageScalingSize = new System.Drawing.Size((int)DpiAware.LogicalToDeviceUnits(24), (int)DpiAware.LogicalToDeviceUnits(24));
            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripButton1,
            this.toolStripSeparator2,
            this.btnPrint,
            this.toolStripSeparator1,
            this.btnGoToFirstPage,
            this.btnGoToPreviousPage,
            this.txtCurrentPageIndex,
            this.toolStripLabel1,
            this.lblTotalPageCount,
            this.btnGoToNextPage,
            this.btnGoToLastPage,
            this.toolStripButton3,
            this.btnZoomOut,
            this.btnZoomIn,
            this.cmbCurrentZoomLevel,
            this.toolStripSeparator3,
            this.FitPage,
            this.toolStripSeparator5,
            this.FitWidth});
            this.toolStrip1.Location = new System.Drawing.Point(0, 0);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(633, 25);
            this.toolStrip1.TabIndex = 0;
            this.toolStrip1.Text = "toolStrip1";
            this.toolStrip1.ImageScalingSize = new Size((int)DpiAware.LogicalToDeviceUnits(24f), (int)DpiAware.LogicalToDeviceUnits(24f));
            this.toolStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            //
            // toolStripButton1
            //
            this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripButton1.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("toolStripButton1.png"));
            this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.toolStripButton1.Name = "toolStripButton1";
            this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
            this.toolStripButton1.Text = "Click to open a PDF document.";
            this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
            //
            // toolStripSeparator2
            //
            this.toolStripSeparator2.Name = "toolStripSeparator2";
            this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
            //
            // btnPrint
            //
            this.btnPrint.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnPrint.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnPrint.png"));
            this.btnPrint.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnPrint.Name = "btnPrint";
            this.btnPrint.Size = new System.Drawing.Size(23, 22);
            this.btnPrint.Text = "Click to Print this PDF file or pages from it.";
            this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
            //
            // toolStripSeparator1
            //
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
            //
            // btnGoToFirstPage
            //
            this.btnGoToFirstPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnGoToFirstPage.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnGoToFirstPage.png"));
            this.btnGoToFirstPage.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnGoToFirstPage.Name = "btnGoToFirstPage";
            this.btnGoToFirstPage.Size = new System.Drawing.Size(23, 22);
            this.btnGoToFirstPage.Text = "toolStripButton2";
            this.btnGoToFirstPage.ToolTipText = "Click to go to first page in the document.";
            this.btnGoToFirstPage.Click += new System.EventHandler(this.btnGoToFirstPage_Click);
            //
            // btnGoToPreviousPage
            //
            this.btnGoToPreviousPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnGoToPreviousPage.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnGoToPreviousPage.png"));
            this.btnGoToPreviousPage.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnGoToPreviousPage.Name = "btnGoToPreviousPage";
            this.btnGoToPreviousPage.Size = new System.Drawing.Size(23, 22);
            this.btnGoToPreviousPage.Text = "toolStripButton3";
            this.btnGoToPreviousPage.ToolTipText = "Click to go to previous page in the document.";
            this.btnGoToPreviousPage.Click += new System.EventHandler(this.btnGoToPreviousPage_Click);
            //
            // txtCurrentPageIndex
            //
            this.txtCurrentPageIndex.Name = "txtCurrentPageIndex";
            this.txtCurrentPageIndex.Size = new System.Drawing.Size(30, 25);
            this.txtCurrentPageIndex.Text = "1";
            this.txtCurrentPageIndex.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtCurrentPageIndex.KeyDown += new System.Windows.Forms.KeyEventHandler(txtCurrentPageIndex_KeyDown);
            this.txtCurrentPageIndex.Click += new System.EventHandler(txtCurrentPageIndex_Click);
            //
            // toolStripLabel1
            //
            this.toolStripLabel1.Name = "toolStripLabel1";
            this.toolStripLabel1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
            this.toolStripLabel1.Size = new System.Drawing.Size(17, 22);
            this.toolStripLabel1.Text = "/";
            //
            // lblTotalPageCount
            //
            this.lblTotalPageCount.Name = "lblTotalPageCount";
            this.lblTotalPageCount.Size = new System.Drawing.Size(25, 22);
            this.lblTotalPageCount.Text = "100";
            //
            // btnGoToNextPage
            //
            this.btnGoToNextPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnGoToNextPage.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnGoToNextPage.png"));
            this.btnGoToNextPage.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnGoToNextPage.Name = "btnGoToNextPage";
            this.btnGoToNextPage.Size = new System.Drawing.Size(23, 22);
            this.btnGoToNextPage.Text = "toolStripButton4";
            this.btnGoToNextPage.ToolTipText = "Click to go to next page in the document.";
            this.btnGoToNextPage.Click += new System.EventHandler(this.btnGoToNextPage_Click);
            //
            // btnGoToLastPage
            //
            this.btnGoToLastPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnGoToLastPage.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnGoToLastPage.png"));
            this.btnGoToLastPage.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnGoToLastPage.Name = "btnGoToLastPage";
            this.btnGoToLastPage.Size = new System.Drawing.Size(23, 22);
            this.btnGoToLastPage.Text = "toolStripButton5";
            this.btnGoToLastPage.ToolTipText = "Click to go to last page in the document.";
            this.btnGoToLastPage.Click += new System.EventHandler(this.btnGoToLastPage_Click);
            //
            // toolStripButton3
            //
            this.toolStripButton3.Name = "toolStripButton3";
            this.toolStripButton3.Size = new System.Drawing.Size(6, 25);
            //
            // btnZoomOut
            //
            this.btnZoomOut.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnZoomOut.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnZoomOut.png"));
            this.btnZoomOut.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnZoomOut.Name = "btnZoomOut";
            this.btnZoomOut.Size = new System.Drawing.Size(40, 40);
            this.btnZoomOut.ToolTipText = "Click to increase the magnification of the entire page.";
            this.btnZoomOut.Click += new System.EventHandler(this.ZoomOut_Click);
            //
            // btnZoomIn
            //
            this.btnZoomIn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.btnZoomIn.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("btnZoomIn.png"));
            this.btnZoomIn.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnZoomIn.Name = "btnZoomIn";
            this.btnZoomIn.Size = new System.Drawing.Size(40, 40);
            this.btnZoomIn.Text = "toolStripButton4";
            this.btnZoomIn.ToolTipText = "Click to decrease the magnification of the entire page.";
            this.btnZoomIn.Click += new System.EventHandler(this.ZoomIn_Click);
            //
            // cmbCurrentZoomLevel
            //
            this.cmbCurrentZoomLevel.Items.AddRange(new object[] {
            "50%",
            "75%",
            "100%",
            "125%",
            "150%",
            "200%",
            "400%"});
            this.cmbCurrentZoomLevel.Name = "cmbCurrentZoomLevel";
            this.cmbCurrentZoomLevel.Size = new System.Drawing.Size(75, 25);
            this.cmbCurrentZoomLevel.Text = "100%";
            this.cmbCurrentZoomLevel.SelectedIndexChanged += new System.EventHandler(this.cmbCurrentZoomLevel_SelectedIndexChanged);
            //
            // toolStripSeparator3
            //
            this.toolStripSeparator3.Name = "toolStripSeparator3";
            this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
            //
            // FitPage
            //
            this.FitPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.FitPage.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("FitPage.png"));
            this.FitPage.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.FitPage.Name = "FitPage";
            this.FitPage.Size = new System.Drawing.Size(23, 22);
            this.FitPage.Text = "Fit Page";
            this.FitPage.Click += new System.EventHandler(this.FitPage_Click);
            //
            // toolStripSeparator5
            //
            this.toolStripSeparator5.Name = "toolStripSeparator5";
            this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
            //
            // FitWidth
            //
            this.FitWidth.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.FitWidth.Image = System.Drawing.Image.FromFile(MultiTabbedViewerDataSource.GetImagePath("FitWidth.png"));
            this.FitWidth.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.FitWidth.Name = "FitWidth";
            this.FitWidth.Size = new System.Drawing.Size(23, 22);
            this.FitWidth.Text = "Fit Width";
            this.FitWidth.Click += new System.EventHandler(this.FitWidth_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoSize = true;
            this.ClientSize = new System.Drawing.Size(633, 386);
            this.Controls.Add(this.tabControlAdv1);
            this.Controls.Add(this.toolStrip1);
            this.Icon = new System.Drawing.Icon(MultiTabbedViewerDataSource.GetIconPath("Icon.ico"));
            this.Name = "Form1";
            this.Text = "Multi Tabbed Viewer";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Load += new System.EventHandler(this.Form1_Load);
            this.Tab1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.tabControlAdv1)).EndInit();
            this.tabControlAdv1.ResumeLayout(false);
            this.Tab2.ResumeLayout(false);
            this.Tab3.ResumeLayout(false);
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        private System.Windows.Forms.ToolTip Tooltip;
        private Syncfusion.Windows.Forms.Tools.TabControlAdv tabControlAdv1;
        private Syncfusion.Windows.Forms.Tools.TabPageAdv Tab1;
        private Syncfusion.Windows.Forms.Tools.TabPageAdv Tab2;
        private Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView pdfDocumentView1;
        private Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView pdfDocumentView2;
        private System.Windows.Forms.ToolStrip toolStrip1;
        private System.Windows.Forms.ToolStripButton btnPrint;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.ToolStripButton btnGoToFirstPage;
        private System.Windows.Forms.ToolStripButton btnGoToPreviousPage;
        private System.Windows.Forms.ToolStripTextBox txtCurrentPageIndex;
        private System.Windows.Forms.ToolStripLabel toolStripLabel1;
        private System.Windows.Forms.ToolStripLabel lblTotalPageCount;
        private System.Windows.Forms.ToolStripButton btnGoToNextPage;
        private System.Windows.Forms.ToolStripButton btnGoToLastPage;
        private System.Windows.Forms.ToolStripComboBox cmbCurrentZoomLevel;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
        private System.Windows.Forms.ToolStripSeparator toolStripButton3;
        private System.Windows.Forms.ToolStripButton btnZoomIn;
        private System.Windows.Forms.ToolStripButton btnZoomOut;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
        private System.Windows.Forms.ToolStripButton toolStripButton1;
        private Syncfusion.Windows.Forms.Tools.TabPageAdv Tab3;
        private Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView pdfDocumentView3;
        private System.Windows.Forms.ToolStripButton FitPage;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
        private System.Windows.Forms.ToolStripButton FitWidth;
    }
}

```

### src/components/pdfviewer-multi-tabbed-viewer/pdfviewer.cs

```cs
using System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms;
using Syncfusion.Windows.Forms.PdfViewer;
using Syncfusion.Windows.Forms.Tools;

namespace MultiTabbedViewer
{
    /// <summary>
    /// Demonstrates a tabbed PDF viewer where every tab hosts an independent
    /// <see cref="PdfDocumentView"/> and a shared toolbar drives the active tab.
    /// </summary>
    public partial class Form1 : MetroForm
    {
        #region Private Members
        private bool isDisposeCalled = false;
        private Timer pageTimer;
        private PdfDocumentView docViewer;
        #endregion

        #region Constructor

        public Form1()
        {
            InitializeComponent();

            // Position and size of the form.
            Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
            this.MinimumSize = new Size(rect.Width * 2 / 3, rect.Height * (3 / 2));
            this.Location = new Point(rect.Width / 6, 0);
            this.MetroColor = Color.Transparent;
            this.WindowState = FormWindowState.Maximized;
        }
        #endregion

        #region Events
        private void Form1_Load(object sender, EventArgs e)
        {
            docViewer = new PdfDocumentView();
            pageTimer = new Timer();
            //Load all the pdf documents into the tab control
            ActivateControl();
            LoadDocument(pdfDocumentView3, MultiTabbedViewerDataSource.GetDocumentPath(2));
            LoadDocument(pdfDocumentView2, MultiTabbedViewerDataSource.GetDocumentPath(1));
            LoadDocument(pdfDocumentView1, MultiTabbedViewerDataSource.GetDocumentPath(0));

        }
        /// <summary>
        /// On currentPageIndex Keydown
        /// </summary>
        void txtCurrentPageIndex_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                int index;
                if (!string.IsNullOrEmpty(txtCurrentPageIndex.Text))
                {
                    int.TryParse(txtCurrentPageIndex.Text, out index);
                    docViewer.GoToPageAtIndex(index);
                }
                txtCurrentPageIndex.Text = docViewer.CurrentPageIndex.ToString();
            }
        }

        /// <summary>
        /// On CurrentPageIndex Click
        /// </summary>
        void txtCurrentPageIndex_Click(object sender, System.EventArgs e)
        {
            txtCurrentPageIndex.SelectAll();
        }

        /// <summary>
        /// On tab control changed.
        /// </summary>
        private void tabControlAdv1_Click(object sender, EventArgs e)
        {
            ActivateControl();
            EnablePagination();
        }

        /// <summary>
        /// Open a new document in the new tab.
        /// </summary>
        void toolStripButton1_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Pdf Files (.pdf)|*.pdf";
            dialog.ShowDialog();
            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                //Adding a new tab and pdf document viewer control
                string[] separator = { "\\", @"\" };
                string[] FileName = dialog.FileName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                tabControlAdv1.TabPages.Add(new Syncfusion.Windows.Forms.Tools.TabPageAdv(FileName[FileName.Length - 1].ToString()));
                PdfDocumentView pdfDocViewer = new PdfDocumentView();
                pdfDocViewer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
                pdfDocViewer.Dock = System.Windows.Forms.DockStyle.Fill;
                pdfDocViewer.Location = new System.Drawing.Point(0, 0);
                pdfDocViewer.Name = "pdfDocumentView" + (tabControlAdv1.TabPages.Count);
                pdfDocViewer.Size = new System.Drawing.Size(626, 633);
                pdfDocViewer.Text = "pdfDocumentView" + (tabControlAdv1.TabPages.Count);
                //Loads the document into the pdf document viewer
                LoadDocument(pdfDocViewer, dialog.FileName);
                tabControlAdv1.TabPages[tabControlAdv1.TabPages.Count - 1].Controls.Add(pdfDocViewer);
                tabControlAdv1.SelectedIndex = tabControlAdv1.TabPages.Count - 1;
                tabControlAdv1.SelectedTab.Text = FileName[FileName.Length - 1].ToString();
                ActivateControl();
                EnablePagination();
            }
        }

        /// <summary>
        /// Handles next page navigation.
        /// </summary>
        private void btnGoToNextPage_Click(object sender, EventArgs e)
        {
            if (docViewer.CanGoToNextPage)
                docViewer.GoToNextPage();
        }

        /// <summary>
        /// Handles previous page navigation.
        /// </summary>
        private void btnGoToPreviousPage_Click(object sender, EventArgs e)
        {
            if (docViewer.CanGoToPreviousPage)
                docViewer.GoToPreviousPage();
        }

        /// <summary>
        /// Handles last page navigation.
        /// </summary>
        private void btnGoToLastPage_Click(object sender, EventArgs e)
        {
            if (docViewer.CanGoToLastPage)
                docViewer.GoToLastPage();
        }

        /// <summary>
        /// Handles first page navigation.
        /// </summary>
        private void btnGoToFirstPage_Click(object sender, EventArgs e)
        {
            if (docViewer.CanGoToFirstPage)
                docViewer.GoToFirstPage();
        }

        /// <summary>
        /// Handles zoom.
        /// </summary>
        private void cmbCurrentZoomLevel_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ZoomLevel = MultiTabbedViewerDataSource.GetZoomPercentage(cmbCurrentZoomLevel.SelectedItem.ToString());
            docViewer.ZoomTo(ZoomLevel);
        }

        /// <summary>
        /// Handles zoom in.
        /// </summary>
        private void ZoomOut_Click(object sender, EventArgs e)
        {
            if (cmbCurrentZoomLevel.SelectedIndex != 0)
                cmbCurrentZoomLevel.SelectedIndex = cmbCurrentZoomLevel.SelectedIndex - 1;
        }

        /// <summary>
        /// Handles zoom out.
        /// </summary>
        private void ZoomIn_Click(object sender, EventArgs e)
        {
            if (cmbCurrentZoomLevel.SelectedIndex != cmbCurrentZoomLevel.Items.Count - 1)
                cmbCurrentZoomLevel.SelectedIndex = cmbCurrentZoomLevel.SelectedIndex + 1;
        }

        /// <summary>
        /// Prints the document.
        /// </summary>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            PrintDialog dialog = new PrintDialog();

            int pageCount = docViewer.PageCount;
            dialog.AllowPrintToFile = true;
            dialog.AllowSomePages = true;
            dialog.PrinterSettings.FromPage = 1;
            dialog.PrinterSettings.ToPage = pageCount;
            dialog.PrinterSettings.MaximumPage = pageCount;
            dialog.PrinterSettings.MinimumPage = 1;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                docViewer.PrintDocument.PrinterSettings.PrinterName = dialog.PrinterSettings.PrinterName;
                dialog.Document = docViewer.PrintDocument;
                dialog.Document.Print();
            }
        }

        /// <summary>
        /// On tab closed, reorder the document viewer control
        /// </summary>
        private void tabControlAdv1_ControlRemoved(object sender, ControlEventArgs e)
        {
            if (!isDisposeCalled)
            {
                if (tabControlAdv1.SelectedIndex > -1)
                {
                    for (int i = tabControlAdv1.SelectedIndex; i < tabControlAdv1.TabPages.Count; i++)
                    {
                        Control[] pdfControl = tabControlAdv1.TabPages[i].Controls.Find("pdfDocumentView" + (i + 2), true);
                        if (pdfControl.Length > 0 && pdfControl[0] is PdfDocumentView)
                        {
                            PdfDocumentView viewer = pdfControl[0] as PdfDocumentView;
                            viewer.Name = "pdfDocumentView" + (i + 1);
                        }
                    }
                    ActivateControl();
                    EnablePagination();
                }
                else
                {
                    Reset();
                }
            }
            isDisposeCalled = false;
        }

        /// <summary>
        /// Handles the fit page
        /// </summary>
        private void FitPage_Click(object sender, EventArgs e)
        {
            docViewer.ZoomTo(ZoomMode.FitPage);
            cmbCurrentZoomLevel.Text = docViewer.ZoomPercentage.ToString() + "%";
        }

        /// <summary>
        /// Handles the fit width
        /// </summary>
        private void FitWidth_Click(object sender, EventArgs e)
        {
            docViewer.ZoomTo(ZoomMode.FitWidth);
            cmbCurrentZoomLevel.Text = docViewer.ZoomPercentage.ToString() + "%";
        }
        #endregion

        #region Helper methods

        /// <summary>
        /// Load a PDF document.
        /// </summary>
        private void LoadDocument(PdfDocumentView viewer, string fileName)
        {
            if (!System.IO.File.Exists(fileName))
                return;

            viewer.Load(fileName);
            lblTotalPageCount.Text = viewer.PageCount.ToString();
            EnablePagination();
            pageTimer.Tick += pageTimer_Tick;
            pageTimer.Start();
        }

        void pageTimer_Tick(object sender, EventArgs e)
        {
            if (docViewer.PageCount > 1)
            {
                this.btnGoToNextPage.Enabled = true;
                this.btnGoToLastPage.Enabled = true;
                pageTimer.Stop();
            }
        }

        /// <summary>
        /// Assigning page index.
        /// </summary>
        void docViewer_CurrentPageChanged(object sender, EventArgs args)
        {
            int pageIndex = (sender as PdfDocumentView).CurrentPageIndex;
            this.txtCurrentPageIndex.Text = pageIndex.ToString();
            EnablePagination();
        }

        /// <summary>
        /// Enable or disable paginate buttons.
        /// </summary>
        private void EnablePagination()
        {
            this.btnGoToNextPage.Enabled = docViewer.CanGoToNextPage;
            this.btnGoToLastPage.Enabled = docViewer.CanGoToLastPage;
            this.btnGoToPreviousPage.Enabled = docViewer.CanGoToPreviousPage;
            this.btnGoToFirstPage.Enabled = docViewer.CanGoToFirstPage;
        }

        /// <summary>
        /// Activates the current tab control
        /// </summary>
        private void ActivateControl()
        {
            //Find a pdf document viewer in the selected tab page.
            Control[] pdfControl = tabControlAdv1.SelectedTab.Controls.Find("pdfDocumentView" + (tabControlAdv1.SelectedIndex + 1), true);
            if (pdfControl.Length > 0 && pdfControl[0] is PdfDocumentView)
                docViewer = pdfControl[0] as PdfDocumentView;
            //Adding event handler for current page index
            docViewer.CurrentPageChanged += new PdfDocumentView.CurrentPageChangedEventHandler(docViewer_CurrentPageChanged);
            this.txtCurrentPageIndex.Text = docViewer.CurrentPageIndex.ToString();
            this.lblTotalPageCount.Text = docViewer.PageCount.ToString();
            this.cmbCurrentZoomLevel.Text = docViewer.ZoomPercentage.ToString() + "%";
            docViewer.Focus();
        }

        /// <summary>
        /// Reset all the fields
        /// </summary>
        private void Reset()
        {
            btnGoToFirstPage.Enabled = false;
            btnGoToLastPage.Enabled = false;
            btnGoToNextPage.Enabled = false;
            btnGoToPreviousPage.Enabled = false;
            txtCurrentPageIndex.Text = "0";
            lblTotalPageCount.Text = "0";
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            isDisposeCalled = true;
            if (pageTimer != null && pageTimer.Enabled)
                pageTimer.Stop();
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #endregion
    }
}

```
