How to: Load a PDF Document from a File
The following code example shows how to load a document from a file.
The PDF Viewer locks a file until it is opened in the PDF Viewer. (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 opened in the PDF Viewer.
If you want to unlock the file 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.
Use the DocumentViewerControl.DocumentSource to load a document in XAML:
<!--Load document from a file--> <dxpdf:PdfViewerControl x:Name="pdfViewer" ShowStartScreen="True" DocumentSource="..\\..\\Demo.pdf"/>
The PdfViewerControl.OpenDocument method allows you to load a document from a file in code: