Skip to main content

PdfDocumentProcessor.SaveDocument(Stream) Method

Saves the current document to the specified file stream.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.1.dll

NuGet Package: DevExpress.Document.Processor


public void SaveDocument(
    Stream stream


Name Type Description
stream Stream

A Stream value, specifying the location of the saved document.


When you dispose of an output stream that has not been detached, an attempt to apply further changes to a document may cause errors. If you want to close the stream when a document is saved, call the SaveDocument method overload with the detachStream parameter enabled.

If you load and save a document to the same stream, it may lead to unexpected results. Use the PdfDocumentProcessor.SaveDocument(Stream, PdfSaveOptions, Boolean) method overload for safer results.


The PdfDocumentProcessor removes existing signatures from a document when it is saved. However, if you use PdfDocumentProcessor to apply a signature, it is retained.

The code sample below rotates document pages and saves the result:

View Example

using DevExpress.Pdf;

namespace PdfPageRotationExample
  class Program
      static void Main(string[] args)
        using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
          int angle = 0;
          foreach (PdfPage page in pdfDocumentProcessor.Document.Pages) {
              angle = (angle + 90) % 360;
              page.Rotate = angle;
          pdfDocumentProcessor.SaveDocument((new FileStream("Rotated.pdf", FileMode.Create, FileAccess.ReadWrite)));
See Also