Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfViewer.SaveDocument(String) Method

Saves the current PDF to the specified file path.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v24.2.dll

NuGet Package: DevExpress.Win.PdfViewer

#Declaration

public bool SaveDocument(
    string path
)

#Parameters

Name Type Description
path String

A System.String value, specifying the document location.

#Returns

Type Description
Boolean

true, if the document is saved successfully; false, if the document saving operation is cancelled by the user.

#Remarks

When calling this method, canceling the operation will restore the previously saved document file.

If the PdfViewer.DetachStreamAfterLoadComplete property is set to false (default mode) the PDF Viewer locks a file to which a document is saved until the document is opened in the PDF Viewer. If you want the PDF Viewer does not lock the file, set the PdfViewer.DetachStreamAfterLoadComplete property to true.

The following example illustrates how to load a PDF file into the PdfViewer control. Drop the PdfViewer control onto the form, create a Ribbon via the PdfViewer’s smart tag and call the PdfViewer.LoadDocument method.

View Example

using System;
using System.Windows.Forms;

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

        private void Form1_Load(object sender, EventArgs e) {
            this.pdfViewer1.LoadDocument(@"..\..\Report.pdf");
        }
    }
}
See Also