{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "pdfviewer-custom-toolbar",
  "framework": "winforms",
  "type": "registry:component",
  "component": "PdfViewer",
  "variant": "custom-toolbar",
  "dependencies": [
    "Syncfusion.PdfViewer.Windows"
  ],
  "description": "PdfViewer whose built-in toolbar is hidden and replaced with a custom ToolStrip that re-exports the same navigation actions.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/winforms/llms.txt",
    "skillPack": "syncfusion/winforms-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/winforms/pdfviewer-custom-toolbar.md"
  },
  "files": [
    {
      "target": "src/components/pdfviewer-custom-toolbar/pdfviewer.Designer.cs",
      "content": "using Syncfusion.Windows.Forms;\nusing System.Drawing;\n\nnamespace CustomToolbar\n{\n    partial class Form1\n    {\n        /// <summary>\n        /// Required designer variable.\n        /// </summary>\n        private System.ComponentModel.IContainer components = null;\n\n        #region Windows Form Designer generated code\n\n        /// <summary>\n        /// Required method for Designer support - do not modify\n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            this.components = new System.ComponentModel.Container();\n            this.CustomPanel = new System.Windows.Forms.Panel();\n            this.Open = new System.Windows.Forms.ToolStrip();\n            this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();\n            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();\n            this.btnFirst = new System.Windows.Forms.ToolStripButton();\n            this.btnPrevious = new System.Windows.Forms.ToolStripButton();\n            this.txtPageNumber = new System.Windows.Forms.ToolStripTextBox();\n            this.btnNext = new System.Windows.Forms.ToolStripButton();\n            this.btnLast = new System.Windows.Forms.ToolStripButton();\n            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();\n            this.Tooltip = new System.Windows.Forms.ToolTip(this.components);\n            this.pdfViewerControl1 = new Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl();\n            this.panel2 = new System.Windows.Forms.Panel();\n            this.DefaultToolbar = new System.Windows.Forms.RadioButton();\n            this.CustomToolbar = new System.Windows.Forms.RadioButton();\n            this.CustomPanel.SuspendLayout();\n            this.Open.SuspendLayout();\n            this.panel2.SuspendLayout();\n            this.SuspendLayout();\n            //\n            // CustomPanel\n            //\n            this.CustomPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;\n            this.CustomPanel.Controls.Add(this.Open);\n            this.CustomPanel.Dock = System.Windows.Forms.DockStyle.Top;\n            this.CustomPanel.Location = new System.Drawing.Point(0, 30);\n            this.CustomPanel.Name = \"CustomPanel\";\n            this.CustomPanel.Size = new System.Drawing.Size(284, 32);\n            this.CustomPanel.TabIndex = 2;\n            this.CustomPanel.Visible = false;\n            //\n            // Open\n            //\n            this.Open.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\n            this.toolStripButton1,\n            this.toolStripSeparator1,\n            this.btnFirst,\n            this.btnPrevious,\n            this.txtPageNumber,\n            this.btnNext,\n            this.btnLast,\n            this.toolStripSeparator2});\n            this.Open.Location = new System.Drawing.Point(0, 0);\n            this.Open.Name = \"Open\";\n            this.Open.Size = new System.Drawing.Size(284, 27);\n            this.Open.TabIndex = 0;\n            this.Open.Text = \"toolStrip1\";\n            this.Open.ImageScalingSize = new Size((int)DpiAware.LogicalToDeviceUnits(24f), (int)DpiAware.LogicalToDeviceUnits(24f));\n            this.Open.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;\n            //\n            // toolStripButton1\n            //\n            this.toolStripButton1.AutoSize = false;\n            this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;\n            this.toolStripButton1.Image = System.Drawing.Image.FromFile(CustomToolbarDataSource.GetImagePath(\"toolStripButton1.png\"));\n            this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;\n            this.toolStripButton1.Name = \"toolStripButton1\";\n            this.toolStripButton1.Size = new System.Drawing.Size((int)DpiAware.LogicalToDeviceUnits(24f), (int)DpiAware.LogicalToDeviceUnits(24f));\n            this.toolStripButton1.Text = \"Open\";\n            this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);\n            //\n            // toolStripSeparator1\n            //\n            this.toolStripSeparator1.Name = \"toolStripSeparator1\";\n            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 27);\n            //\n            // btnFirst\n            //\n            this.btnFirst.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\n            this.btnFirst.Font = new System.Drawing.Font(\"Segoe UI Semibold\", 9F, System.Drawing.FontStyle.Bold);\n            this.btnFirst.Image = System.Drawing.Image.FromFile(CustomToolbarDataSource.GetImagePath(\"btnFirst.png\"));\n            this.btnFirst.ImageTransparentColor = System.Drawing.Color.Magenta;\n            this.btnFirst.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2);\n            this.btnFirst.Name = \"btnFirst\";\n            this.btnFirst.Size = new System.Drawing.Size(27, 24);\n            this.btnFirst.Text = \"<<\";\n            this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);\n            //\n            // btnPrevious\n            //\n            this.btnPrevious.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\n            this.btnPrevious.Font = new System.Drawing.Font(\"Segoe UI Semibold\", 9F, System.Drawing.FontStyle.Bold);\n            this.btnPrevious.Image = System.Drawing.Image.FromFile(CustomToolbarDataSource.GetImagePath(\"btnPrevious.png\"));\n            this.btnPrevious.ImageTransparentColor = System.Drawing.Color.Magenta;\n            this.btnPrevious.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2);\n            this.btnPrevious.Name = \"btnPrevious\";\n            this.btnPrevious.Size = new System.Drawing.Size(23, 24);\n            this.btnPrevious.Text = \"<\";\n            this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click);\n            //\n            // txtPageNumber\n            //\n            this.txtPageNumber.AutoSize = false;\n            this.txtPageNumber.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\n            this.txtPageNumber.Name = \"txtPageNumber\";\n            this.txtPageNumber.Size = new System.Drawing.Size(35, 23);\n            this.txtPageNumber.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center;\n            this.txtPageNumber.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPageNumber_KeyDown);\n            //\n            // btnNext\n            //\n            this.btnNext.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\n            this.btnNext.Font = new System.Drawing.Font(\"Segoe UI Semibold\", 9F, System.Drawing.FontStyle.Bold);\n            this.btnNext.Image = System.Drawing.Image.FromFile(CustomToolbarDataSource.GetImagePath(\"btnNext.png\"));\n            this.btnNext.ImageTransparentColor = System.Drawing.Color.Magenta;\n            this.btnNext.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2);\n            this.btnNext.Name = \"btnNext\";\n            this.btnNext.Size = new System.Drawing.Size(23, 24);\n            this.btnNext.Text = \">\";\n            this.btnNext.Click += new System.EventHandler(this.btnNext_Click);\n            //\n            // btnLast\n            //\n            this.btnLast.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\n            this.btnLast.Font = new System.Drawing.Font(\"Segoe UI Semibold\", 9F, System.Drawing.FontStyle.Bold);\n            this.btnLast.Image = System.Drawing.Image.FromFile(CustomToolbarDataSource.GetImagePath(\"btnLast.png\"));\n            this.btnLast.ImageTransparentColor = System.Drawing.Color.Magenta;\n            this.btnLast.Margin = new System.Windows.Forms.Padding(5, 1, 0, 2);\n            this.btnLast.Name = \"btnLast\";\n            this.btnLast.Size = new System.Drawing.Size(27, 24);\n            this.btnLast.Text = \">>\";\n            this.btnLast.Click += new System.EventHandler(this.btnLast_Click);\n            //\n            // toolStripSeparator2\n            //\n            this.toolStripSeparator2.Name = \"toolStripSeparator2\";\n            this.toolStripSeparator2.Size = new System.Drawing.Size(6, 27);\n            //\n            // pdfViewerControl1\n            //\n            this.pdfViewerControl1.Dock = System.Windows.Forms.DockStyle.Fill;\n            this.pdfViewerControl1.Location = new System.Drawing.Point(0, 62);\n            this.pdfViewerControl1.Name = \"pdfViewerControl1\";\n            this.pdfViewerControl1.ShowToolBar = true;\n            this.pdfViewerControl1.Size = new System.Drawing.Size(284, 200);\n            this.pdfViewerControl1.TabIndex = 3;\n            this.pdfViewerControl1.Text = \"pdfViewerControl1\";\n            //\n            // panel2\n            //\n            this.panel2.Controls.Add(this.DefaultToolbar);\n            this.panel2.Controls.Add(this.CustomToolbar);\n            this.panel2.Dock = System.Windows.Forms.DockStyle.Top;\n            this.panel2.Location = new System.Drawing.Point(0, 0);\n            this.panel2.Name = \"panel2\";\n            this.panel2.Size = new System.Drawing.Size(284, 30);\n            this.panel2.TabIndex = 4;\n            //\n            // DefaultToolbar\n            //\n            this.DefaultToolbar.AutoSize = true;\n            this.DefaultToolbar.Checked = true;\n            this.DefaultToolbar.Font = new System.Drawing.Font(\"Verdana\", 9.75F);\n            this.DefaultToolbar.Location = new System.Drawing.Point(3, 9);\n            this.DefaultToolbar.Name = \"DefaultToolbar\";\n            this.DefaultToolbar.Size = new System.Drawing.Size(168, 20);\n            this.DefaultToolbar.TabIndex = 0;\n            this.DefaultToolbar.TabStop = true;\n            this.DefaultToolbar.Text = \"Show Default Toolbar\";\n            this.DefaultToolbar.UseVisualStyleBackColor = true;\n            this.DefaultToolbar.CheckedChanged += new System.EventHandler(this.DefaultToolbar_Click);\n            //\n            // CustomToolbar\n            //\n            this.CustomToolbar.AutoSize = true;\n            this.CustomToolbar.Font = new System.Drawing.Font(\"Verdana\", 9.75F);\n            this.CustomToolbar.Location = new System.Drawing.Point(176, 9);\n            this.CustomToolbar.Name = \"CustomToolbar\";\n            this.CustomToolbar.Size = new System.Drawing.Size(170, 20);\n            this.CustomToolbar.TabIndex = 1;\n            this.CustomToolbar.Text = \"Show Custom Toolbar\";\n            this.CustomToolbar.UseVisualStyleBackColor = true;\n            this.CustomToolbar.CheckedChanged += new System.EventHandler(this.DefaultToolbar_Click);\n            //\n            // Form1\n            //\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n            this.ClientSize = new System.Drawing.Size(284, 262);\n            this.Controls.Add(this.pdfViewerControl1);\n            this.Controls.Add(this.CustomPanel);\n            this.Controls.Add(this.panel2);\n            this.Icon = new System.Drawing.Icon(CustomToolbarDataSource.GetIconPath(\"Icon.ico\"));\n            this.Name = \"Form1\";\n            this.Text = \"Custom Toolbar\";\n            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;\n            this.Load += new System.EventHandler(this.Form1_Load);\n            this.CustomPanel.ResumeLayout(false);\n            this.CustomPanel.PerformLayout();\n            this.Open.ResumeLayout(false);\n            this.Open.PerformLayout();\n            this.panel2.ResumeLayout(false);\n            this.panel2.PerformLayout();\n            this.ResumeLayout(false);\n\n        }\n\n        #endregion\n        private System.Windows.Forms.ToolTip Tooltip;\n        private Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl pdfViewerControl1;\n        private System.Windows.Forms.Panel panel2;\n        private System.Windows.Forms.RadioButton CustomToolbar;\n        private System.Windows.Forms.RadioButton DefaultToolbar;\n        private System.Windows.Forms.Panel CustomPanel;\n        private System.Windows.Forms.ToolStrip Open;\n        private System.Windows.Forms.ToolStripButton toolStripButton1;\n        private System.Windows.Forms.ToolStripButton btnFirst;\n        private System.Windows.Forms.ToolStripButton btnPrevious;\n        private System.Windows.Forms.ToolStripButton btnNext;\n        private System.Windows.Forms.ToolStripButton btnLast;\n        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;\n        private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;\n        private System.Windows.Forms.ToolStripTextBox txtPageNumber;\n    }\n}\n"
    },
    {
      "target": "src/components/pdfviewer-custom-toolbar/pdfviewer.cs",
      "content": "using System;\nusing System.Drawing;\nusing System.Windows.Forms;\nusing Syncfusion.Windows.Forms;\n\nnamespace CustomToolbar\n{\n    /// <summary>\n    /// Demonstrates toggling between the built-in PDF viewer toolbar and a\n    /// custom toolbar that drives the viewer programmatically.\n    /// </summary>\n    public partial class Form1 : MetroForm\n    {\n        #region Private members\n        private Timer timer;\n        #endregion\n\n        # region Constructor\n        public Form1()\n        {\n            InitializeComponent();\n\n            // Layout controls.\n            Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;\n            this.MinimumSize = new Size(rect.Width * 2 / 3, rect.Height * (3 / 2));\n            this.Location = new Point(rect.Width / 6, 0);\n\n            this.DefaultToolbar.Height = 24;\n            this.MetroColor = Color.Transparent;\n            this.WindowState = FormWindowState.Maximized;\n        }\n        # endregion\n\n        #region Events\n        /// <summary>\n        /// Loads PDF into PdfViewerControl.\n        /// </summary>\n        private void Form1_Load(object sender, EventArgs e)\n        {\n            timer = new Timer();\n            timer.Tick += timer_Tick;\n            timer.Enabled = true;\n            LoadDocument(CustomToolbarDataSource.GetDocumentPath());\n        }\n\n        /// <summary>\n        /// Toggles between default and custom toolbar.\n        /// </summary>\n        private void DefaultToolbar_Click(object sender, EventArgs e)\n        {\n            if (DefaultToolbar.Checked)\n            {\n                pdfViewerControl1.ShowToolBar = true;\n                CustomPanel.Visible = false;\n            }\n            else\n            {\n                pdfViewerControl1.ShowToolBar = false;\n                CustomPanel.Visible = true;\n                SetPageNumber();\n            }\n        }\n\n        /// <summary>\n        /// Handles open button in the custom toolbar.\n        /// </summary>\n        private void toolStripButton1_Click(object sender, EventArgs e)\n        {\n            OpenFileDialog dialog = new OpenFileDialog();\n            dialog.Filter = CustomToolbarDataSource.OpenFileFilter;\n            dialog.ShowDialog();\n            if (!string.IsNullOrEmpty(dialog.FileName))\n                LoadDocument(dialog.FileName);\n        }\n\n        private void btnFirst_Click(object sender, EventArgs e)\n        {\n            pdfViewerControl1.GoToPageAtIndex(1);\n            SetPageNumber();\n        }\n\n        private void btnLast_Click(object sender, EventArgs e)\n        {\n            pdfViewerControl1.GoToPageAtIndex(pdfViewerControl1.PageCount);\n            SetPageNumber();\n        }\n\n        private void btnPrevious_Click(object sender, EventArgs e)\n        {\n            if (pdfViewerControl1.CurrentPageIndex != 1)\n            {\n                pdfViewerControl1.GoToPageAtIndex(pdfViewerControl1.CurrentPageIndex - 1);\n            }\n\n            SetPageNumber();\n        }\n\n        private void btnNext_Click(object sender, EventArgs e)\n        {\n            if (pdfViewerControl1.CurrentPageIndex != pdfViewerControl1.PageCount)\n            {\n                pdfViewerControl1.GoToPageAtIndex(pdfViewerControl1.CurrentPageIndex + 1);\n            }\n\n            SetPageNumber();\n        }\n\n        private void timer_Tick(object sender, EventArgs e)\n        {\n            SetPageNumber();\n        }\n\n        /// <summary>\n        /// Handles Keydown event of PageNumber Textbox\n        /// </summary>\n        private void txtPageNumber_KeyDown(object sender, KeyEventArgs e)\n        {\n            timer.Stop();\n            int pageNumber = 1;\n            if (txtPageNumber.Text != \"\")\n            {\n                pageNumber = Convert.ToInt16(txtPageNumber.Text);\n            }\n            if (e.KeyCode == Keys.Enter)\n            {\n                pdfViewerControl1.GoToPageAtIndex(pageNumber);\n                timer.Start();\n            }\n        }\n\n        #endregion\n\n        #region Helper methods\n        /// <summary>\n        /// Loads PDF into PdfViewerControl.\n        /// </summary>\n        private void LoadDocument(string fileName)\n        {\n            if (System.IO.File.Exists(fileName))\n            {\n                pdfViewerControl1.Load(fileName);\n            }\n        }\n\n        void SetPageNumber()\n        {\n            txtPageNumber.Text = pdfViewerControl1.CurrentPageIndex.ToString();\n        }\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n        protected override void Dispose(bool disposing)\n        {\n            if (timer != null && timer.Enabled)\n                timer.Stop();\n            pdfViewerControl1.Dispose();\n            if (disposing && (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n        #endregion\n    }\n}\n"
    }
  ]
}