ByteScout PDF Viewer SDK - C# - Sample UI Application - ByteScout

ByteScout PDF Viewer SDK – C# – Sample UI Application

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Viewer SDK – C# – Sample UI Application

ByteScout PDF Viewer SDK – C# – Sample UI Application

Form1.cs

using System;
using System.Windows.Forms;

namespace Sample_UI_Application
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void tsbOpen_Click(object sender, EventArgs e)
		{
			using (OpenFileDialog openFileDialog = new OpenFileDialog())
			{
				openFileDialog.Title = @"Open PDF Document";
				openFileDialog.Filter = @"PDF Files (*.pdf)|*.pdf|All Files|*.*";

				if (openFileDialog.ShowDialog() == DialogResult.OK)
				{
					this.Text = openFileDialog.FileName;

					Cursor = Cursors.WaitCursor;

					try
					{
						pdfViewerControl1.InputFile = openFileDialog.FileName;
					}
					catch (Exception exception)
					{
						MessageBox.Show(exception.Message);
					}
					finally
					{
						Cursor = Cursors.Default;
					}
				}
			}
		}
	}
}

Program.cs

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Sample_UI_Application
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new Form1());
		}
	}
}


  Click here to get your Free Trial version of the SDK

prev
next