Classic ASP calls the component through COM. Use a 32-bit application pool with the 32-bit build, or a 64-bit pool with the 64-bit build; mixing bitness is the most common cause of CreateObject failures.

The sample loads a PDF, encrypts it with a permission mask and writes the result to disk.

Before you start

  1. Install the DLL on the web server and register it for the application-pool identity.
  2. Confirm the application pool's 32-bit setting matches the installed build.
  3. Place the source and destination folders outside the web root or protect them with NTFS permissions.
  4. Call SetLicenseKey() before processing.

Complete example

ASP
<% 
Dim obj
path = server.MapPath(".")
Set obj = CreateObject("PDFEncryptX.EncryptLib")
iRtn = obj.LoadFromFile("..\PDFEncryptX.pdf", "")
obj.SetLicenseKey "Your code here"
'Create Permissions: Can not to print, copy and edit.
iPermissions = obj.CreatePermission(0, 0, 0, 1, 1, 1, 1, 1)
'Call Encrypt() method
iRtn = obj.Encrypt("..\PDFEncryptX_CanNot_Print_Copy_Edit.pdf", 2, iPermissions, "owner", "user")
Response.Write "Encrypt() Return code:" & CLng(iRtn)
set obj = Nothing
%>

How it works

  • IIS application pools recycle; release objects with Set obj = Nothing.
  • The account running the pool needs read access to the input and write access to the output folder.
  • Do not expose license keys in client-side code; this runs server-side only.
During evaluation, leave the placeholder license key in place. After purchase, replace it with the key from your email.