Example Program in VB.NET

This program loads a file hello.pdf from disk and writes out a document with the original included three times.

 Merge example
imports System
imports System.Collections.Generic
imports CoherentGraphics

 Initialise cpdf
Cpdf.startup()

 We will take the input hello.pdf and repeat it three times
Using mergepdf As Cpdf.Pdf = Cpdf.fromFile("hello.pdf", "")
   The list of PDFs to merge
  Dim pdfs As List(Of Cpdf.Pdf) =
    new List(Of Cpdf.Pdf)({mergepdf, mergepdf, mergepdf})

   Merge them
  Dim merged As Cpdf.Pdf = Cpdf.mergeSimple(pdfs)

   Write output
  Cpdf.toFile(merged, "merged.pdf", false, false)

   Dispose of merged PDF
  merged.Dispose()
End Using

Note the use of Using and Dispose() to ensure the PDFs are thrown away when no longer required.