Back to Devexpress

PdfViewerControl.OpenDocument(String) Method

wpf-devexpress-dot-xpf-dot-pdfviewer-dot-pdfviewercontrol-dot-opendocument-x28-system-dot-string-x29.md

latest3.6 KB
Original Source

PdfViewerControl.OpenDocument(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Opens a PDF document.

Namespace : DevExpress.Xpf.PdfViewer

Assembly : DevExpress.Xpf.PdfViewer.v25.2.dll

NuGet Package : DevExpress.Wpf.PdfViewer

Declaration

csharp
public override void OpenDocument(
    string filePath = null
)
vb
Public Overrides Sub OpenDocument(
    filePath As String = Nothing
)

Optional Parameters

NameTypeDefaultDescription
filePathStringnull

A string specifying the path to the PDF document.

|

Remarks

If the PdfViewerControl.DetachStreamOnLoadComplete property is set to false (default mode) the PDF Viewer locks a file until it is opened in the PDF Viewer. If you want the PDF Viewer does not lock the file, set the PdfViewerControl.DetachStreamOnLoadComplete property to true.

The following code snippets (auto-collected from DevExpress Examples) contain references to the OpenDocument(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-pdf-viewer-customize-the-popup-menu/CS/MainWindow.xaml.cs#L12

csharp
// Load a document.
    viewer.OpenDocument("..\\..\\Demo.pdf");
}

wpf-pdf-viewer-import-and-export-acroform-data/CS/MainWindow.xaml.cs#L11

csharp
InitializeComponent();
    Viewer.OpenDocument("FormFillDemo.pdf");
}

wpf-pdf-viewer-customize-the-popup-menu/VB/MainWindow.xaml.vb#L14

vb
' Load a document.
    viewer.OpenDocument("..\..\Demo.pdf")
End Sub

wpf-pdf-viewer-import-and-export-acroform-data/VB/MainWindow.xaml.vb#L12

vb
InitializeComponent()
    Viewer.OpenDocument("FormFillDemo.pdf")
End Sub

See Also

PdfViewerControl Class

PdfViewerControl Members

DevExpress.Xpf.PdfViewer Namespace