PdfDocumentProcessor.SaveDocument(Stream) Method
Saves the current document to the specified file stream.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A Stream value, specifying the location of the saved document. |
#Remarks
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.
Important
The Pdf
The code sample below rotates document pages and saves the result:
using DevExpress.Pdf;
namespace PdfPageRotationExample
{
class Program
{
static void Main(string[] args)
{
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextRotate.pdf");
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)));
}
}
}
}