Overview

PDF Security ActiveX DLL

Are you a developer? Do you want to add the "PDF Encryption", "PDF Decryption", "Set the permission of the user such as printing, modifying, etc" feature to your application?

Now, you can try PDF Security ActiveX DLL, with a few function calls, it helps you decrypt & encrypt pdf in your Win programs or Web applications.

PDF Security ActiveX DLL was intended to Protect Adobe Acrobat PDF files, that comes with "owner" and "user" password set, preventing the file from editing (changing), printing, selecting text and graphics (and copying them into the Clipboard), or adding/changing annotations and form fields.

PDF Security ActiveX DLL also provides the ability to decrypt an encrypted PDF given the password.

All editions of Adobe Acrobat (including 5.x, 6.x, 7.x, 8.x, 9.x which tools 40-bit,128-bit RC4 & AES, 256-bit AES encryption) are allowed by PDF Security ActiveX DLL.

It is a standalone component and does not depend on Adobe Acrobat, or even Acrobat Reader.

Key Features

  • Remove the security settings from your encrypted PDF file is instant.
  • Decrypt protected Adobe Acrobat PDF files, removing restrictions on printing, editing, copying.
  • Password protects the opening of the document.
  • Password protection for PDF files with 40-bit or 128-bit or 256-bit encryption.
  • Support add user password and owner password.
  • Support add printing, copying, and changing permissions to an encrypted PDF file.
  • Support many development languages, such as VB Script, Javascript, Perl, Php, Python, ASP, ASP.Net, VB.Net, C#, VB6, Cold Fusion, Delphi, VC++, Java, etc.
  • Support detect whether the PDF file is encrypted.
  • Royalty-free, Use PDF Security ActiveX DLL in your applications without needing to pay any royalty fees for distribution.
  • No limits on the number of applications.
  • Support Windows XP/VISTA/7/8/10/11 and Windows Server 2003/2008/2012/2016(Include R2).
  • Support Windows 32-bit and Windows 64-bit.

Screenshot

System Requirements

Desktop

  • Windows XP (32-bit, 64-bit)
  • Windows Vista (32-bit, 64-bit)
  • Windows 7 (32-bit, 64-bit)
  • Windows 8/8.1 (32-bit, 64-bit)
  • Windows 10 (32-bit, 64-bit)

Server

  • Windows Server 2003 (32-bit, 64-bit)
  • Windows Server 2008 (32-bit, 64-bit)
  • Windows Server 2012 (32-bit, 64-bit)
  • Windows Server 2016 (32-bit, 64-bit)

FAQ

  • What development languages are supported?
    A: A lot. The DLL component is based on ActiveX, which can be used with VB Script, Javascript, Perl, Php, Python, ASP, ASP.Net, VB.Net, C#, VB6, Cold Fusion, Delphi, VC++, Java, etc. We have provided examples for all of the above languages.
  • How do I register the component?
    A: Once you buy the DLL component, The registration code and download link of the full version will be sent to you by email. After creating an object instance of ActiveX DLL in your favorite programming languages, call the SetLicenseKey() method with the code you got by email. In this way, every limitation in the trial mode will be removed.
  • Can you do custom development for special usage?
    A: Sure. Please tell us what you need and we can discuss a cost, and then develop a custom version on schedule just for you.

Sample code: Encrypt / Decrypt PDF with Delphi, VB, C#, ASP, PHP

» 1. Delphi Sample Code: Encrypt / Decrypt PDF with Delphi

procedure TForm1.Button1Click(Sender: TObject);
var
  obj: OleVariant;
  iRtn, iPermissions: Integer;
  sInFile, sOutFile: string;
begin
  OpenDialog1.InitialDir := ExtractFilePath(Application.ExeName);
  if not OpenDialog1.Execute then
  begin
    Exit;
  end else
  begin
    sInFile := OpenDialog1.FileName;
  end;

  try
    obj := CreateOleObject('PDFSecurityX.SecurityLib'); //Create object
  except
    on E: Exception do
    begin
      ShowMessage('Please install AzSDK PDF Security ActiveX DLL first.');
      Exit;
    end;
  end;

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

  iRtn := obj.LoadFromFile(sInFile, ''); //Load PDF file
  {
    iRtn = 1: loaded successful
    iRtn = 0: Can not Load
    iRtn =-1: File not exist
  }

  //if load file successful, then get relational property.
  if iRtn = 1 then
  begin
    if obj.IsEncrypted = 1 then //Encrypted PDF ?
      edtEncrypted.Text := '1->YES'
    else edtEncrypted.Text := '0->NO';

    edtPage.Text := IntToStr(obj.PageCount); //Page count of PDF

    edtSize.Text := IntToStr(obj.FileSize); //File size of PDF
  end;

  //Create Permissions: Can not to print, copy and edit.
  iPermissions := obj.CreatePermissions(0, 0, 0, 1, 1, 1, 1, 1);

  //Call Encrypt() method
  sOutFile := ChangeFileExt(sInFile, '') + '_Encrypted.pdf';  
  iRtn := obj.Encrypt(sOutFile, 2, iPermissions, 'OwnerPwd', '');
  case iRtn of
    0: edtEResult.Text := '0->Encrypt failed';
    1: edtEResult.Text := '1->Encrypt successful';
    2: edtEResult.Text := '2->Ignore - file already encrypted';
  end;

  //Call Decrypt() method
  //Load Encrypted PDF file
  obj.LoadFromFile(sOutFile, 'OwnerPwd');
  sOutFile := ChangeFileExt(sInFile, '') + '_Decrypted.pdf';
  iRtn := obj.Decrypt(sOutFile);
  case iRtn of
    0: edtDResult.Text := '0->Decrypt failed';
    1: edtDResult.Text := '1->Decrypt successful';
    2: edtDResult.Text := '2->File not encrypted';
  end;

  obj.Close; //Close file
  Obj := Unassigned;
end;

» 2. Visual Basic Sample Code: Encrypt / Decrypt PDF with Visual Basic

Private Sub Command1_Click()
    Dim obj As Object
    Dim iRtn As Long
    Dim iPermissions As Long
  
    Set obj = CreateObject("PDFSecurityX.SecurityLib")    'Create object
      
    obj.SetLicenseKey ("License Code")                  'Set your license key
  
    iRtn = obj.LoadFromFile("..\PDFSecurityX.pdf", "")    'Load PDF file
    'iRtn = 1: loaded successful
    'iRtn=0:Load Failed;
     
    'if load file successful, then get relational property.
    If iRtn = 1 Then
        If obj.IsEncrypted = 1 Then     'Encrypted PDF ?
            Text1.Text = "YES"
        Else
            Text1.Text = "NO"
        End If
        
        Text2.Text = obj.PageCount      'Page count of PDF
        
        Text3.Text = obj.FileSize       'File size of PDF
    End If
    
    'Create Permissions: Can not to print, copy and edit.
    iPermissions = obj.CreatePermissions(0, 0, 0, 1, 1, 1, 1, 1)
    
    'Call encrypt() method
    iRtn = obj.Encrypt("..\PDFSecurityX_Encrypted.pdf", 2, iPermissions, "OwnerPwd", "")
    If iRtn = 0 Then
        Text4.Text = "0->Encrypt failed"
    ElseIf iRtn = 1 Then
        Text4.Text = "1->Encrypt successful"
    ElseIf iRtn = 2 Then
        Text4.Text = "2->Ignore - file already encrypted"
    End If
    
    'Call decrypt() method
    iRtn = obj.LoadFromFile("..\PDFSecurityX_Encrypted.pdf", "")    'Load Encrypted PDF file
    iRtn = obj.Decrypt("..\PDFSecurityX_Decrypted.pdf")
    If iRtn = 0 Then
        Text5.Text = "0->Decrypt failed"
    ElseIf iRtn = 1 Then
        Text5.Text = "1->Decrypt successful"
    ElseIf iRtn = 2 Then
        Text5.Text = "2->File not encrypted"
    End If
    
    obj.Close       'Close file
    Set obj = Nothing
End Sub

» 3. C# Sample Code: Encrypt / Decrypt PDF with C# (C-Sharp)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PDFSecurityX;

namespace Application1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            SecurityLibClass obj = new PDFSecurityX.SecurityLibClass();

            obj.SetLicenseKey("License Code");

            int iRtn = obj.LoadFromFile("..\\..\\..\\PDFSecurityX.pdf", "");

            if (iRtn == 1)
            {
                if (obj.IsEncrypted == 1)
                {
                    textBox1.Text = "YES";
                }
                else
                {
                    textBox1.Text = "NO";
                }
                textBox2.Text = obj.PageCount.ToString();
                textBox3.Text = obj.FileSize.ToString();
            }

            //Create Permissions: Can not to print, copy and edit.
            int iPermissions = obj.CreatePermissions(0, 0, 0, 1, 1, 1, 1, 1);

            //Call encrypt() method
            int iEnValue = obj.Encrypt("..\\..\\..\\PDFSecurityX_Encrypted.pdf", 2, iPermissions, "", "");
            switch (iEnValue)
            {
                case 0: textBox4.Text = "0->Encrypt failed"; break;
                case 1: textBox4.Text = "1->Encrypt successful"; break;
                case 2: textBox4.Text = "2->Ignore - file already encrypted"; break;
            }

            //Load encrypted pdf file
            iRtn = obj.LoadFromFile("..\\..\\..\\PDFSecurityX_Encrypted.pdf", "");
            //Call decrypt() method
            int iDeValue = obj.Decrypt("..\\..\\..\\PDFSecurityX_Decrypted.pdf");
            switch (iDeValue)
            {
                case 0: textBox5.Text = "0->Decrypt failed"; break;
                case 1: textBox5.Text = "1->Decrypt successful"; break;
                case 2: textBox5.Text = "2->File not encrypted"; break;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}

» 4. ASP Sample Code: Encrypt / Decrypt PDF with ASP

<% 

Dim obj

path = server.MapPath(".")

Set obj = CreateObject("PDFSecurityX.SecurityLib")

iRtn = obj.LoadFromFile("..\PDFSecurityX.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("..\PDFSecurityX_Encrypted.pdf", 2, iPermissions, "OwnerPwd", "")
Response.Write "Encrypt() Return code:" & CLng(iRtn)

'Load Encrypted PDF
iRtn = obj.LoadFromFile("..\PDFSecurityX_Encrypted.pdf", "OwnerPwd")
'Call Decrypt() method
iRtn = obj.Decrypt("..\PDFSecurityX_Decrypted.pdf")
Response.Write "Decrypt() Return code:" & CLng(iRtn)

set obj = Nothing

%>

» 5. PHP Sample Code: Encrypt / Decrypt PDF with PHP

SetLicenseKey("License Code");  //Set your license key

  if ( 1 == $obj->LoadFromFile("../PDFSecurityX.pdf", "") )  //Load PDF file
  {
	//Create Permissions: Can not to print, copy and edit.
	iPermissions = $obj->CreatePermission(0, 0, 0, 1, 1, 1, 1, 1)

	//Call encrypt() method
    if ( 1 == $obj->Encrypt("../PDFSecurityX_Encrypted.pdf", 2, iPermissions, "OwnerPwd", "") )
	{
	  echo "Encrypt successful." ;
	}

	//Load Encrypted PDF
	$obj->LoadFromFile("../PDFSecurityX_Encrypted.pdf", "OwnerPwd")
	//Call decrypt() method
    if ( 1 == $obj->Decrypt("../PDFSecurityX_Decrypted.pdf") )
	{
	  echo "Decrypt successful." ;
	}

    $obj->Close();  //Close file
  }

  $obj = null;
?>

Unregistered Copy Limitation

  • Popup a nag window in the trial version.
  • Add watermark to target PDF file.