PdfViewer.SaveDocument(String) Method
Saves the current PDF to the specified file path.
Namespace: DevExpress.XtraPdfViewer
Assembly: DevExpress.XtraPdfViewer.v19.1.dll
Declaration
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-show-a-pdf-file-using-the-pdfviewer-control-e4696
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");
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SaveDocument(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.