Add(PdfPage) Method (PdfPageCollection)
Adds the
PdfPage at specified index into the
PdfPageCollection.
Here is an example that shows how to copy the first page of PDF document and add the page at the end of the same PDF document:
''' <summary>
''' Copies the first page of PDF document to the end of PDF document.
''' </summary>
''' <param name="pdfFileName">The filename of PDF document.</param>
Public Shared Sub CopyFirstPdfPageToEndOfPdfDocument(pdfFileName As String)
' open PDF document
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName)
' get the collection of pages of PDF document
Dim pages As Vintasoft.Imaging.Pdf.Tree.PdfPageCollection = document.Pages
' add first page to the end of PDF document
pages.Add(pages(0))
' save changes to a file
document.SaveChanges()
End Using
End Sub
/// <summary>
/// Copies the first page of PDF document to the end of PDF document.
/// </summary>
/// <param name="pdfFileName">The filename of PDF document.</param>
public static void CopyFirstPdfPageToEndOfPdfDocument(string pdfFileName)
{
// open PDF document
using (Vintasoft.Imaging.Pdf.PdfDocument document =
new Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName))
{
// get the collection of pages of PDF document
Vintasoft.Imaging.Pdf.Tree.PdfPageCollection pages = document.Pages;
// add first page to the end of PDF document
pages.Add(pages[0]);
// save changes to a file
document.SaveChanges();
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5