This VB6 sample uses late binding to split, merge and rotate PDF files. It is intentionally small so you can paste it into an existing project and adapt the file paths.

Before you start

  1. Install the trial build and register the component.
  2. Create the object with CreateObject.
  3. Set your license key before calling Split, Merge or Rotate.
  4. Check the return code and release the object when done.

Complete example

VB6
Private Sub Command1_Click()
    Dim obj As Object
    Dim iRtn As Integer
    Dim iPageCount As Integer

    'Create object
    Set obj = CreateObject("PDFSplitMergeX.SplitMergeLib")

    'Set your license key
    obj.SetLicenseKey ("License Code")

    'Split PDF file
    iRtn = obj.Split("..\PDF-Split-Merge-ActiveX-DLL.pdf","","1,2-3,4-5,6","..\split-%d.pdf")
    If iRtn = 1 Then
      MsgBox "Split Successfuly."
    End If

    'Merge PDF file
    iRtn = obj.Merge('..\split-1.pdf|..\split-2.pdf?1-1', '..\merge-1.pdf');
    If iRtn = 1 Then
      MsgBox "Merge Successfuly."
    End If

    'Get Page Count
    iPageCount = obj.GetPageCount("..\PDF-Split-Merge-ActiveX-DLL.pdf", "");

    Set obj = Nothing
End Sub

How it works

  • File lists for Merge use |; append ?1-2 to select pages from a file.
  • Output patterns support %d for split files.
  • Use Set obj = Nothing at the end of the operation.
During evaluation, leave the placeholder license key in place. After purchase, replace it with the key from your email.