officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor-dot-savedocument-x28-system-dot-string-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Saves the current document to the specified file path.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void SaveDocument(
string path
)
Public Sub SaveDocument(
path As String
)
| Name | Type | Description |
|---|---|---|
| path | String |
A String value, specifying the location of the saved document.
|
The PDF Document API component locks a file while a document is saved (since the SaveDocument method uses the detachStream parameter set to false ). To unlock the file, call another overloaded SaveDocument method with the detachStream parameter enabled.
Important
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:
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("..\\..\\docs\\Rotated.pdf");
}
}
}
}
Imports DevExpress.Pdf
Namespace PdfPageRotationExample
Friend Class Program
Shared Sub Main(ByVal args() As String)
Using pdfDocumentProcessor As New PdfDocumentProcessor()
pdfDocumentProcessor.LoadDocument("..\..\docs\TextRotate.pdf")
Dim angle As Integer = 0
For Each page As PdfPage In pdfDocumentProcessor.Document.Pages
angle = (angle + 90) Mod 360
page.Rotate = angle
Next page
pdfDocumentProcessor.SaveDocument("..\..\docs\Rotated.pdf")
End Using
End Sub
End Class
End Namespace
The following code snippets (auto-collected from DevExpress Examples) contain references 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.
pdf-document-api-xmp-example/CS/XmpMetadataExamples/Program.cs#L54
// Save the result:
pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf");
}
pdf-document-api-flatten-interactive-form/CS/FlattenInteractiveForm/Program.cs#L17
// Save a document with the flattened form field.
processor.SaveDocument("..\\..\\..\\Result1.pdf");
pdf-document-api-remove-interactive-form-fields/CS/RemoveInteractiveForm/Program.cs#L16
// Save the modified document.
processor.SaveDocument("..\\..\\..\\Result1.pdf");
how-to-custom-draw-in-pdf-viewer/CS/PDF_Viewer/Form1.cs#L57
}
processor.SaveDocument(saveFileDialog.FileName);
}
pdf-document-api-delete-pages-from-document/CS/PdfDeletePageExample/Program.cs#L23
}
pdfDocumentProcessor.SaveDocument("..\\..\\..\\docs\\Deleted.pdf");
}
pdf-document-api-xmp-example/VB/XmpMetadataExamples/Program.vb#L43
' Save the result:
pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf")
End Using
pdf-document-api-flatten-interactive-form/VB/FlattenInteractiveForm/Program.vb#L16
' Show a message if the form field was not found in a document.
processor.SaveDocument("..\..\..\Result1.pdf")
Else
pdf-document-api-remove-interactive-form-fields/VB/RemoveInteractiveForm/Program.vb#L15
' Save the modified document.
processor.SaveDocument("..\..\..\Result1.pdf")
Else
how-to-custom-draw-in-pdf-viewer/VB/PDF_Viewer/Form1.vb#L52
processor.SaveDocument(saveFileDialog.FileName)
End Using
pdf-document-api-delete-pages-from-document/VB/PdfDeletePageExample/Program.vb#L19
Next
pdfDocumentProcessor.SaveDocument("..\..\..\docs\Deleted.pdf")
End Using
See Also