This tutorial shows the three core operations of the PDF Split Merge ActiveX DLL from Delphi: splitting a document into page-range files, merging selected pages from multiple files, and rotating pages.

All operations accept a password for protected inputs and return an integer status code.

Before you start

  1. Install the PDF Split Merge ActiveX DLL trial.
  2. Create the object with CreateOleObject('PDFSplitMergeX.SplitMergeLib').
  3. Call SetLicenseKey() before the first operation.
  4. Use ranges such as 1-3,4-6 and output patterns such as part-%d.pdf.

Complete example

Delphi
procedure TForm1.Button1Click(Sender: TObject);
var
  obj: OleVariant;
  iRtn, iPageCount: Integer;
begin
  //Create object
  obj := CreateOleObject('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
  begin
    ShowMessage('Split Successfuly.');
  end;

  //Merge PDF file
  iRtn:= obj.Merge('..\split-1.pdf|..\split-2.pdf?1-1', '..\merge-1.pdf');
  if iRtn = 1 then
  begin
    ShowMessage('Merge Successfuly.');
  end;

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

  Obj := Unassigned;
end;

How it works

  • Split output names use %d, which is replaced by the output file number.
  • Merge file lists use | as a separator and ? for per-file page ranges.
  • Rotate accepts 90, 180 or 270 degrees.
During evaluation, leave the placeholder license key in place. After purchase, replace it with the key from your email.