/// <summary> /// Create a PDF Viewer. /// </summary> public PdfViewer() { // Initialize the object. this.windowsFormHost = new WindowsFormsHost(); this.pdfPageView = new PDFPageView(); // Configure the control. The PDF Viewer from O2 Solutions is a Forms based control, but the desired usage is WPF. The generic UserControl is // given a special control that can host this Windows Forms control. This window hierarchy allows the consumer of this library to be ignorant of the // WindowsFormsIntegration assembly. this.Content = this.windowsFormHost; this.windowsFormHost.Child = this.pdfPageView; // This serial number prevents the 'Evaluation Copy' message from appearin in the control. It validates that we've got a developer license to // build using this control. this.pdfPageView.Document = new PDFDocument(); this.pdfPageView.Document.SerialNumber = "PDFVW-6ATTA-DK6XD-A2XTO-AIQUM-3ECYE"; }
public Form2(string pdfFile) { InitializeComponent(); this.Text = pdfFile; Assembly assembly = Assembly.GetExecutingAssembly(); Stream stream = assembly.GetManifestResourceStream(string.Format("fwdzsjrj.{0}.pdf", pdfFile)); PDFPageView pageView = new PDFPageView(); pageView.Dock = DockStyle.Fill; pageView.Document = new PDFDocument(); pageView.Document.Load(stream); this.Controls.Add(pageView); pageView.ZoomMode = PDFZoomMode.FitWidth; }
/// <summary> /// Initializes a new instance of the PdfPage class. /// </summary> public PdfPage() { // Initialize the IDE maintained fields. this.InitializeComponent(); // Initialize the object. this.pdfPageView = new PDFPageView(); this.windowsFormHost = new WindowsFormsHost(); this.windowsFormHost.Child = this.pdfPageView; this.Content = this.windowsFormHost; // Create a single document to view all the PDF content. this.pdfPageView.Document = new PDFDocument(); this.pdfPageView.Document.SerialNumber = "PDFVW-6ATTA-DK6XD-A2XTO-AIQUM-3ECYE"; // Since this is a page it is expected to load and unload from memory at any time and handle itself accordingly. These event handlers will take care of // binding to the frame application when loaded and unbinding when not part of the application anymore. this.Loaded += new RoutedEventHandler(this.OnLoaded); this.Unloaded += new RoutedEventHandler(this.OnUnloaded); }