ByteScout PDF SDK – VB.NET – Copy Pages From One Document To Another

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VB.NET – Copy Pages From One Document To Another

ByteScout PDF SDK – VB.NET – Copy Pages From One Document To Another

Module1.vb

Imports Bytescout.PDF

Module Module1

    Sub Main()

        ' Open first document
        Dim document1 = New Document("document1.pdf")
        document1.RegistrationName = "demo"
        document1.RegistrationKey = "demo"
        ' Open second document
        Dim document2 = New Document("document2.pdf")
        document2.RegistrationName = "demo"
        document2.RegistrationKey = "demo"

        ' Add pages from document2 to document1
        For i As Integer = 0 To document2.Pages.Count - 1
            document1.Pages.Add(document2.Pages(i))
        Next

        ' Save merged document
        document1.Save("MergedDocument.pdf")

        ' Open merged document in default PDF viewer application
        Process.Start("MergedDocument.pdf")

    End Sub

End Module


  Click here to get your Free Trial version of the SDK

prev
next