Two compact examples show the same workflow in classic ASP and in PHP on Windows. Both create PDFSplitMergeX.SplitMergeLib, split a document into numbered parts and merge selected pages.

Server-side COM requires the DLL to be registered for the account and bitness of the web process.

Before you start

  1. Install the DLL on the web server.
  2. Match the application pool or PHP process bitness to the installed build.
  3. Grant the process account read/write access to the working folders.
  4. Set your license key before the first call.

Complete example

ASP
<%
Dim obj
path = server.MapPath(".")
Set obj = CreateObject("PDFSplitMergeX.SplitMergeLib")
obj.SetLicenseKey "Your LicenseKey here"
'split to mutiple files
obj.Split path&"PDF-Split-Merge-ActiveX-DLL.pdf", "", "1,2-3,4-5,6", path&"\split-%d.pdf"
'merge a range a file and another file to a new file
obj.Merge path&"\split-1.pdf|"&path&"\split-2.pdf?1-1", path&"\merge-1.pdf"
Set obj = Nothing	
%>
PHP
<?php
$path = getcwd()."\\";
$com = new COM("PDFSplitMergeX.SplitMergeLib");
$com->SetLicenseKey('Your LicenseKey here');
$com->Split($path."PDF-Split-Merge-ActiveX-DLL.pdf", "", "1,2-3,4-5,6", $path."split-%d.pdf");
$com->Merge($path."split-1.pdf|".$path."split-2.pdf?1-1", $path."merge-1.pdf");
$nPage = $com->GetPageCount($path."PDF-Split-Merge-ActiveX-DLL.pdf", "");
print "Page Count of PDF-Split-Merge-ActiveX-DLL.pdf is ".$nPage;
?>

How it works

  • ASP uses Server.CreateObject; PHP uses new COM() with the COM extension enabled.
  • The examples write files into the current working directory; use an absolute, protected path in production.
  • Return codes: 1 success, 0 failure, negative values for bad ranges or paths.
During evaluation, leave the placeholder license key in place. After purchase, replace it with the key from your email.