ClonePage.vb
''
'' This code is part of Document Solutions for PDF .NET demos.
'' Copyright (c) MESCIUS inc. All rights reserved.
''
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text

Public Class ClonePage
    Public Function CreatePDF(ByVal stream As Stream) As Integer
        Dim doc = New GcPdfDocument()
        Using fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf"))
            doc.Load(fs)

            ' Clone the first page of the PDF, insert it into the beginning of the document:
            doc.Pages.ClonePage(0, 0, True, True)

            ' Save the PDF:
            doc.Save(stream)
            Return doc.Pages.Count
        End Using
    End Function
End Class