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

PdfViewer.LoadDocument(Stream) Method

Loads a PDF document from the specified stream.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v18.2.dll

Declaration

public void LoadDocument(
    Stream stream
)

Parameters

Name Type Description
stream Stream

A Stream class descendant.

Remarks

If the PdfViewer.DetachStreamAfterLoadComplete property is set to false (default mode), the input stream should not be closed until a document is opened.

If you want to close the stream when a document is opened, set the PdfViewer.DetachStreamAfterLoadComplete property to true before specifying the document source.

Example

The following example illustrates how to load a document into the PDF Viewer from a stream at runtime.

To accomplish this task: create a FileStream object with the specified file path to open the existing file, and call one of the PdfViewer.LoadDocument overloaded method with this stream object passed as a parameter.

using System.IO;
using System.Windows.Forms;

namespace LoadDocumentFromStream {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            // Load a document from the stream.
            FileStream stream = new FileStream("..\\..\\Demo.pdf", FileMode.Open);
            pdfViewer1.LoadDocument(stream);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the LoadDocument(Stream) 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.

See Also