Skip to main content
A newer version of this page is available. .

How to: Load a PDF Document from a Uri

  • 2 minutes to read

This example shows how to load a document in the PDF Viewer from a Uri using the DocumentViewerControl.DocumentSource property.

Important

When you load a document, the input stream should not be closed before the control finishes using a document (PdfViewerControl.DetachStreamOnLoadComplete is set to false by default). This allows the PDF Viewer to render a large PDF quickly but makes it impossible to edit or delete the document until it is open in the PDF Viewer.

If you want to close the stream after a document is loaded into the PDF Viewer, set the PdfViewerControl.DetachStreamOnLoadComplete property to true. However, in this case the high rendering performance is not guaranteed.

<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" />
    </Grid>
</Window>