Getting started with XFINIUM.PDF Viewer in WPF applications

This tutorial will show how to get started with XFINIUM.PDF Viewer in WPF applications.

1. Add XFINIUM.PDF Viewer to Visual Studio toolbox.

2. Open your window xaml in Visual Studio Designer.

Getting started with XFINIUM.PDF viewer in WPF applications

3. Drag a PdfCoreView control from the toolbox onto the form and name the control ‘documentView‘. References to xfinium.pdf.wpf.dll, xfinium.pdf.render.wpf.dll and xfinium.pdf.view.wpf.dll will be added automatically to your project.

4. Embed the documentView control in a ScrollViewer.

5. In your window’s Loaded event create a PdfVisualDocument object, set the documentView.Document property with the PdfVisualDocument object and load a file in the document.

C#

Xfinium.Pdf.View.PdfVisualDocument document = new Xfinium.Pdf.View.PdfVisualDocument();
documentView.Document = document;
FileStream pdfStream = File.OpenRead("D:\Doc\xfinium.pdf");
document.Load(pdfStream);
pdfStream.Close();

VB

Dim document As New Xfinium.Pdf.View.PdfVisualDocument()
documentView.Document = document
Dim pdfStream As FileStream = File.OpenRead("D:Docxfinium.pdf")
document.Load(pdfStream)
pdfStream.Close()

6. Run the application.

2 thoughts on “Getting started with XFINIUM.PDF Viewer in WPF applications”

  1. Is there any way to enable a toolbar for the pdf viewer. Like getting zoom and annotate controls?
    Another component?
    Or something I would have to implement myself?

    1. The viewer just displays the PDF pages. All the UI around it (toolbars, etc) must be built in your application to match your application UI.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: