using pdftron.PDF; using System; using System.Windows.Forms; namespace AsposePDF_Viewer_Test { public partial class Form1 : Form { private PDFViewCtrl PDFview; public Form1() { InitializeComponent(); PDFview = new PDFViewCtrl(); PDFview.ShowToolbar(true); PDFview.ShowNavPanel(true); PDFview.ShowDialogs(true); PDFview.ShowMenuBar(true); PDFview.ShowNavToolbar(true); PDFview.ShowStatusBar(true); PDFview.Dock = DockStyle.Fill; pnlView.Controls.Add(PDFview); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog opnFileDlg = new OpenFileDialog(); opnFileDlg.Title = "설계파일 열기"; if (opnFileDlg.ShowDialog() == DialogResult.OK) { string[] filelist = opnFileDlg.FileNames; OpenPDFView(filelist[0]); } } public void OpenPDFView(string filename) { try { PDFDoc pdfdoc = PDFview.GetDoc(); PDFview.CloseDoc(); if (pdfdoc != null) { pdfdoc.Dispose(); } pdfdoc = new PDFDoc(filename); PDFview.SetDoc(pdfdoc); textBox1.Text = "정상작동"; } catch (Exception ex) { textBox1.Text = ex.ToString(); } } } }