Save(String) Method (PdfDocument)
In This Topic
Saves the PDF document to file.
Syntax
'Declaration
Public Overloads Sub Save( _
ByVal As System.String _
)
public void Save(
System.String
)
public: void Save(
System.String
)
public:
void Save(
System.String
)
Parameters
- filename
- File name to save PDF document.
Remarks
All further changes will affect the source of PDF document only.
Example
Here is an example that shows how to load an existing PDF document from file, add a page to the document and save the document to a new file:
''' <summary>
''' Loads PDF document from a file, adds page to PDF document and
''' saves changes to the new file.
''' </summary>
''' <param name="sourcePdfFilename">The filename of source PDF document.</param>
''' <param name="destPdfFilename">The filename of destination PDF document.</param>
Public Shared Sub OpenPdfDocumentAndSaveToNewFile(sourcePdfFilename As String, destPdfFilename As String)
' open PDF document
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(sourcePdfFilename)
' add new page to PDF document
document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
' save PDF document to the new file
document.Save(destPdfFilename)
End Using
End Sub
/// <summary>
/// Loads PDF document from a file, adds page to PDF document and
/// saves changes to the new file.
/// </summary>
/// <param name="sourcePdfFilename">The filename of source PDF document.</param>
/// <param name="destPdfFilename">The filename of destination PDF document.</param>
public static void OpenPdfDocumentAndSaveToNewFile(
string sourcePdfFilename,
string destPdfFilename)
{
// open PDF document
using (Vintasoft.Imaging.Pdf.PdfDocument document =
new Vintasoft.Imaging.Pdf.PdfDocument(sourcePdfFilename))
{
// add new page to PDF document
document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4);
// save PDF document to the new file
document.Save(destPdfFilename);
}
}
Requirements
Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
See Also