wpf-114459-controls-and-libraries-pdf-viewer-examples-file-operations-how-to-load-a-pdf-document-from-a-uri.md
This example shows how to use the DocumentViewerControl.DocumentSource property to load a document from a Uri.
using System;
using System.Windows;
using System.Reflection;
namespace LoadPDFDocument
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Uri baseUri = new Uri(Assembly.GetEntryAssembly().Location);
Uri uri = new Uri(baseUri, "..\\..\\Demo.pdf");
Viewer.DocumentSource = uri;
}
}
}
Imports System
Imports System.Windows
Imports System.Reflection
Namespace LoadPDFDocument
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
Dim baseUri As New Uri(System.Reflection.Assembly.GetEntryAssembly().Location)
Dim uri As New Uri(baseUri, "..\..\Demo.pdf")
Viewer.DocumentSource = uri
End Sub
End Class
End Namespace
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxpdf="http://schemas.devexpress.com/winfx/2008/xaml/pdf"
x:Class="LoadPDFDocument.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxpdf:PdfViewerControl x:Name="Viewer"
DocumentSource="pack://application:,,,/DxPdfViewer;component/Demo.pdf"/>
</Grid>
</Window>