Permissions

The Permissions property is the permission given to the User only.  It doesn't include the Owner of the PDF file.

 

Syntax

ActiveX:

System.Int32 Permissions

DLL:

long GetPermissions(HANDLE hIntf)
void SetPermissions(HANDLE hIntf, long nNewValue)

 

Parameters

Permissions, nNewValue

User Permissions using Encryption 40 bits:

Permission Type

Value (Hex)

Value (Dec)*

No permission.

0xFFFFFFC0

-64

Enable Printing (high resolution).

0xFFFFFFC0 | 0x000004

-64 + 4

Enable document modification, including document assembly and fill-in existing interactive form fields (including signature fields).

0xFFFFFFC0 | 0x000008

-64 + 8

Enable copying text and graphics, and support of accessibility to users with disabilities or for other purposes.

0xFFFFFFC0 | 0x000010

-64 + 16

Enable adding and changing notes, and fill-in existing interactive form fields (including signature fields).

0xFFFFFFC0 | 0x000020

-64 + 32

(*) NOTE: Converting from HEX DWORD, unsigned and 32-bit unit of data

 

User Permissions using Encryption 128 bits:

Permission Type

Value (Hex)

Value (Dec)*

No permission.

0xFFFFF0C0

-3904

Enable Printing (low resolution)

0xFFFFF0C0 | 0x000004

-3904 + 4

Enable document modification, including document assembly.

0xFFFFF0C0 | 0x000008

-3904 + 8

Enable copying text and graphics, and support of accessibility to users with disabilities or for other purposes.

0xFFFFF0C0 | 0x000010

-3904 + 16

Enable adding and changing notes, and fill-in existing interactive form fields (including signature fields).

0xFFFF0C0 | 0x000020

-3904 + 32

Enable only fill-in existing interactive form fields (including signature fields).

0xFFFF0C0 | 0x000100

-3904 + 256

Enable extraction text and graphics (in support of accessibility to users with disabilities or for other purposes)

0xFFFF0C0 | 0x000200

-3904 + 512

Enable document assembly which includes: insert, rotate or delete pages and create bookmark or thumbnail images, but not document modification.

0xFFFF0C0 | 0x000400

-3904 + 1024

Enable High-Quality Printing, but the if "Enable Printing" has to be enabled.

0xFFFF0C0 | 0x000800

-3904 + 2048

(*) NOTE: Converting from HEX DWORD, unsigned and 32-bit unit of data

 

User Permissions using Encryption 256 bits:

 

 
AES256 Version 5, Revision 5
AES256 Version 5, Revision 6

Permission Type

Value (Hex)

Value (Dec)*

Value (Hex)

Value (Dec)*

No permission.

0xFFFFF0C0

-3904

0x0FFFF0C0

268431552

Enable Printing (low resolution)

0xFFFFF0C0 | 0x000004

-3904 + 4

0x0FFFF0C0 | 0x000004

268431552 + 4

Enable document modification, including document assembly.

0xFFFFF0C0 | 0x000008

-3904 + 8

0x0FFFF0C0 | 0x000008

268431552 + 8

Enable copying text and graphics, and support of accessibility to users with disabilities or for other purposes.

0xFFFFF0C0 | 0x000010

-3904 + 16

0x0FFFF0C0 | 0x000010

268431552 + 16

Enable adding and changing notes, and fill-in existing interactive form fields (including signature fields).

0xFFFF0C0 | 0x000020

-3904 + 32

0x0FFF0C0 | 0x000020

268431552 + 32

Enable only fill-in existing interactive form fields (including signature fields).

0xFFFF0C0 | 0x000100

-3904 + 256

0x0FFF0C0 | 0x000100

268431552 + 256

Enable extraction text and graphics (in support of accessibility to users with disabilities or for other purposes)

0xFFFF0C0 | 0x000200

-3904 + 512

0x0FFF0C0 | 0x000200

268431552 + 512

Enable document assembly which includes: insert, rotate or delete pages and create bookmark or thumbnail images, but not document modification.

0xFFFF0C0 | 0x000400

-3904 + 1024

0x0FFF0C0 | 0x000400

268431552 + 1024

Enable High-Quality Printing, but the if "Enable Printing" has to be enabled.

0xFFFF0C0 | 0x000800

-3904 + 2048

0x0FFF0C0 | 0x000800

268431552 + 2048

 

 

hIntf

Handle to printer returned by any of the DriverInit function calls.

 

Return Value

Permissions and GetPermissions return the current value for the property.

 

Remarks

The encryption, owner and user passwords are configured by using Encryption, OwnerPassword and UserPassword properties.

 

The user' s permissions will override them if the PDF document is opened using the owner' s password.

 

Member of CDIntfEx.CDIntfEx.

 

Example

Using Encryption 40 bits:

<Flags()>

Public Enum PERMISSIONS As Integer

    NO_PERMISSION = &HFFFFFFC0

    ENABLE_PRINTING = &H4

    ENABLE_DOCUMENT_MODIFICATION = &H8

    ENABLE_COPYING_TEXT_GRAPHICS = &H10

    ENABLE_ADDING_CHANGING_NOTES = &H20

End Enum

 

<Flags()>

Public Enum acFileNameOptions As Integer

    ' Please check FileNameOptions for the complete flags version

    NoPrompt = &H1

    UseFileName = &H2

    Concatenate = &H4

    DisableCompression = &H8

    EmbedFonts = &H10

    BroadcastMessages = &H20

    PrintWatermark = &H40

    EncryptDocument = &H100

    EncryptDocument128 = &H40000000

End Enum

Public Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"

    Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    Const AMYUNIPRINTERNAME As String = "Amyuni PDF Converter"

 

    ' Declare a new cdintfex object if it does not exist in the form.

    Dim PDF As New CDIntfEx.CDIntfEx

 

    ' Get a reference to the installed printer.

    ' This will fail if the printer name passed to the DriverInit method is 

    ' not found in the printer’s folder

    PDF.DriverInit(AMYUNIPRINTERNAME)

 

    ' The SetDefaultPrinter function sets the system default printer to the one

    ' initialized by the DriverInit functions.

    PDF.SetDefaultPrinter()

 

    ' The EnablePrinter() method needs to be called right before each print job.

    ' and before the configuration

    ' Calling the EnablePrinter() method will start a 20 second time-out value

    PDF.EnablePrinter(strLicenseTo, strActivationCode)

 

    ' Resulting PDF document stored here

    PDF.DefaultDirectory = "C:\Temp"

 

    ' Set Printer options

    PDF.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.EncryptDocument

 

    ' Set OwnerPassword

    PDF.OwnerPassword = "owner123"

 

    ' Set UserPassword

    PDF.UserPassword = "user123"

 

    ' Set Permissions

    PDF.Permissions = PERMISSIONS.NO_PERMISSION Or PERMISSIONS.ENABLE_PRINTING

 

    ' Apply Settings

    PDF.SetDefaultConfig()

 

    ' The BatchConvert method converts a number of files to PDF.

    PDF.BatchConvert("C:\Temp\*.docx")

 

    ' The RestoreDefaultPrinter function resets the system default printer 

    ' to the printer that was the default before the call to SetDefaultPrinter.

    PDF.RestoreDefaultPrinter()

 

    ' This function will simply detach from an existing printer because the handle was created using DriverInit

    PDF.DriverEnd()

End Sub

[Flags]

public enum PERMISSIONS

{

    NO_PERMISSION = unchecked((int)0xFFFFFFC0),

    ENABLE_PRINTING = 0x4,

    ENABLE_DOCUMENT_MODIFICATION = 0x8,

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10,

    ENABLE_ADDING_CHANGING_NOTES = 0x20

}

 

[Flags]

public enum acFileNameOptions

{

    // Please check FileNameOptions for the complete flags version

    NoPrompt = 0x00000001,

    UseFileName = 0x00000002,

    Concatenate = 0x00000004,

    DisableCompression = 0x00000008,

    EmbedFonts = 0x00000010,

    BroadcastMessages = 0x00000020,

    PrintWatermark = 0x00000040,

    EncryptDocument = 0x00000100,

    EncryptDocument128 = 0x40000000

}

 

public void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Converter Evaluation";

    const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

    const string AMYUNIPRINTERNAME = "Amyuni PDF Converter";

 

    // Declare a new cdintfex object if it does not exist in the form.

    CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    PDF.DriverInit(AMYUNIPRINTERNAME);

 

    // The SetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    PDF.SetDefaultPrinter();

 

    // The EnablePrinter() method needs to be called right before each print job.

    // and before the configuration

    // Calling the EnablePrinter() method will start a 20 second time-out value

    PDF.EnablePrinter(strLicenseTo, strActivationCode);

 

    // Resulting PDF document stored here

    PDF.DefaultDirectory = @"C:\Temp";

 

    // Set Printer options

    PDF.FileNameOptionsEx = (int)(acFileNameOptions.NoPrompt | acFileNameOptions.EncryptDocument);

 

    // Set OwnerPassword

    PDF.OwnerPassword = "owner123";

 

    // Set UserPassword

    PDF.UserPassword = "user123";

 

    // Set Permissions

    PDF.Permissions = (int)(PERMISSIONS.NO_PERMISSION | PERMISSIONS.ENABLE_PRINTING));

 

    // Apply Settings

    PDF.SetDefaultConfig();

 

    // The BatchConvert method converts a number of files to PDF.

    PDF.BatchConvert(@"C:\Temp\*.docx");

 

    // The RestoreDefaultPrinter function resets the system default printer 

    // to the printer that was the default before the call to SetDefaultPrinter.

    PDF.RestoreDefaultPrinter();

 

    // This function will simply detach from an existing printer because the handle was created using DriverInit

    PDF.DriverEnd();

}

// PDF Converter Cpp.cpp : Defines the entry point for the console application.

// 

# include <Windows.h>

# include <string>

# include <iostream>

# include "CdIntf.h"

# pragma comment (lib, "CDIntf.lib")

 

using namespace std;

 

enum PERMISSIONS 

{

    NO_PERMISSION = 0xFFFFFFC0,

    ENABLE_PRINTING = 0x4,

    ENABLE_DOCUMENT_MODIFICATION = 0x8,

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10,

    ENABLE_ADDING_CHANGING_NOTES = 0x20

}; 

 

int main()

{

     // Constants for Activation codes

    #define strLicenseTo  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    #define AMYUNIPRINTERNAME "Amyuni PDF Converter"

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);

 

    // The CDISetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    CDISetDefaultPrinter(PDF);

 

    // The EnablePrinter() method needs to be called right before each print job.

    // and before the configuration

    // Calling the EnablePrinter() method will start a 20 second time-out value

    EnablePrinter(PDF, strLicenseTo, strActivationCode);

 

    // Resulting PDF document stored here

    SetDefaultDirectory(PDF, "C:\temp");

 

    // Set Printer options

    SetFileNameOptions(PDF, NoPrompt | EncryptDocument);

 

    // Set OwnerPassword

    SetOwnerPassword(PDF, "owner123");

 

    // Set UserPassword

    SetUserPassword(PDF, "user123";

 

    // Set Permissions

    SetPermissions(PDF, PERMISSIONS::NO_PERMISSION | PERMISSIONS::ENABLE_PRINTING);

 

    // The BatchConvert method converts a number of files to PDF.

    BatchConvertEx(PDF, "C:\temp\\*.docx");

 

    // The RestoreDefaultPrinter function resets the system default printer 

    // to the printer that was the default before the call to SetDefaultPrinter.

    RestoreDefaultPrinter(PDF);

 

    // This function will simply detach from an existing printer because the handle was created using DriverInit

    DriverEnd(PDF);    

 

    // Destroy PDF object

    PDF = nullptr;    

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

 

public class Sample {

    public enum PERMISSIONS 

    {

        NO_PERMISSION (0xFFFFFFC0),

        ENABLE_PRINTING (0x4),

        ENABLE_DOCUMENT_MODIFICATION (0x8),

        ENABLE_COPYING_TEXT_GRAPHICS (0x10),

        ENABLE_ADDING_CHANGING_NOTES (0x20);

        public int value;

        public PERMISSIONS(int value)

        {

            this.value = value;

        }

        public Object value(){

            return value;

        }

    }

 

    public enum acFileNameOptions

    {

        // Please check FileNameOptions for the complete flags version

        NoPrompt(0x00000001),

        UseFileName(0x00000002),

        Concatenate(0x00000004),

        DisableCompression(0x00000008),

        EmbedFonts(0x00000010),

        BroadcastMessages(0x00000020),

        PrintWatermark(0x00000040),

        EncryptDocument(0x00000100),

        EncryptDocument128(0x40000000);

        public int value;

        public acFileNameOptions(int value)

        {

            this.value = value;

        }

        public Object value(){

            return value;

        }

    }

 

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "Amyuni PDF Converter Evaluation";

        String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

        String AMYUNIPRINTERNAME = "Amyuni PDF Converter";

 

        // Declare a new cdintfex object if it does not exist in the form.

        ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5"); 

 

        // Get a reference to the installed printer.

        // This will fail if the printer name passed to the DriverInit method is 

        // not found in the printer’s folder

        Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);

 

        // The SetDefaultPrinter function sets the system default printer to the one

        // initialized by the DriverInit functions.

        Dispatch.call(pdf,"SetDefaultPrinter");

 

        // The EnablePrinter() method needs to be called right before each print job.

        // and before the configuration

        // Calling the EnablePrinter() method will start a 20 second time-out value

        Dispatch.call(pdf,"EnablePrinter", strLicenseTo, strActivationCode);

 

        // Resulting PDF document stored here

        Dispatch.put(pdf,"DefaultDirectory","C:\temp");

 

        // Set Printer options

        Dispatch.put(pdf,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.EncryptDocument.value );

 

        // Set OwnerPassword

        Dispatch.call(pdf,"OwnerPassword", "owner123");

 

        // Set UserPassword

        Dispatch.call(pdf,"UserPassword", "user123");

 

        // Set Permissions

        Dispatch.call(pdf,"Permissions", PERMISSIONS.NO_PERMISSION.value + PERMISSIONS.ENABLE_PRINTING.value);

 

        // The BatchConvert method converts a number of files to PDF.

        Dispatch.call(pdf,"BatchConvert","C:\temp\\*.docx");

 

        // The RestoreDefaultPrinter function resets the system default printer 

        // to the printer that was the default before the call to SetDefaultPrinter.

        Dispatch.call(pdf,"RestoreDefaultPrinter"); 

 

        // This function will simply detach from an existing printer because the handle was created using DriverInit

        Dispatch.call(pdf,"DriverEnd");

 

        // Destroy PDF object

        pdf = null;        

    }

}

$PERMISSIONS = @{

    NO_PERMISSION = 0xFFFFFFC0

    ENABLE_PRINTING = 0x4

    ENABLE_DOCUMENT_MODIFICATION = 0x8

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10

    ENABLE_ADDING_CHANGING_NOTES = 0x20

}

 

$acFileNameOptions = @{

    NoPrompt = 0x00000001

    UseFileName = 0x00000002

    Concatenate = 0x00000004

    DisableCompression = 0x00000008

    EmbedFonts = 0x00000010

    BroadcastMessages = 0x00000020

    PrintWatermark = 0x00000040

    EncryptDocument = 0x00000100

    EncryptDocument128 = 0x40000000

 

# Please check FileNameOptions for the complete flags version

 

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

$AMYUNIPRINTERNAME = "Amyuni PDF Converter"

 

# Declare a new cdintfex object if it does not exist in the form.

$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5

 

# Get a reference to the installed printer.

# This will fail if the printer name passed to the DriverInit method is 

# not found in the printer’s folder

[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME) 

 

# The SetDefaultPrinter function sets the system default printer to the one

# initialized by the DriverInit functions.

[System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)

 

# The EnablePrinter()method needs to be called right before each print job.

# and before the configuration

# Calling the EnablePrinter()method will start a 20 second time-out value

[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))

 

# Resulting PDF document stored here

[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,"C:\Temp") 

 

# Set Printer options

[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acFileNameOptions::NoPrompt -bOr $acFileNameOptions::EncryptDocument)

 

# Set OwnerPassword

[System.__ComObject].InvokeMember('OwnerPassword', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "owner123")

 

# Set UserPassword

[System.__ComObject].InvokeMember('UserPassword', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "user123")

 

# Set Permissions

[System.__ComObject].InvokeMember('Permissions', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $PERMISSIONS::NO_PERMISSION -bOr $PERMISSIONS::ENABLE_PRINTING)

 

# The BatchConvert method converts a number of files to PDF.

[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "C:\Temp\*.docx")

 

# The RestoreDefaultPrinter function resets the system default printer 

# to the printer that was the default before the call to SetDefaultPrinter.

[System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null) 

 

# This function will simply detach from an existing printer because the handle was created using DriverInit 

[System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null) 

 

# Destroy PDF object

$PDF = $null

' Permissions

Const NO_PERMISSION = -64

Const ENABLE_PRINTING = 4

Const ENABLE_DOCUMENT_MODIFICATION = 8

Const ENABLE_COPYING_TEXT_GRAPHICS = 16

Const ENABLE_ADDING_CHANGING_NOTES = 32

 

' FileNameOptions constants

' Please check FileNameOptions for the complete flags version

Const NoPrompt = &H1

Const UseFileName = &H2

Const Concatenate = &H4

Const DisableCompression = &H8

Const EmbedFonts = &H10

Const BroadcastMessages = &H20

Const PrintWatermark = &H40

Const MultilingualSupport = &H80

Const EncryptDocument = &H100

Const EncryptDocument128 = &H40000000

 

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

Const AMYUNIPRINTERNAME = "Amyuni PDF Converter"

 

' Declare a new cdintfex object

Dim PDF

Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")

 

' Get a reference to the installed printer.

' This will fail if the printer name passed to the DriverInit method is

' not found in the printer’s folder

PDF.DriverInit AMYUNIPRINTERNAME

 

' The SetDefaultPrinter function sets the system default printer to the one

' initialized by the DriverInit functions.

PDF.SetDefaultPrinter

 

' The EnablePrinter() method needs to be called right before each print job.

' and before the configuration

' Calling the EnablePrinter() method will start a 20 second time-out value

PDF.EnablePrinter strLicenseTo, strActivationCode

 

' Resulting PDF document stored here

PDF.DefaultDirectory = "C:\Temp"

 

' Set Printer options

PDF.FileNameOptionsEx = NoPrompt Or EncryptDocument

 

' Set OwnerPassword

PDF.OwnerPassword = "owner123"

 

' Set UserPassword

PDF.UserPassword = "user123"

 

' Set Permissions

PDF.Permissions = NO_PERMISSION + ENABLE_PRINTING

 

' Apply Settings

PDF.SetDefaultConfig

 

' The BatchConvert method converts a number of files to PDF.

PDF.BatchConvert "C:\Temp\*.docx"

 

' The RestoreDefaultPrinter function resets the system default printer

' to the printer that was the default before the call to SetDefaultPrinter.

PDF.RestoreDefaultPrinter

 

' This function will simply detach from an existing printer because the handle was created using DriverInit

PDF.DriverEnd

 

' Destroy PDF object

Set PDF = Nothing

 

Encryption 128 bits

<Flags()>

Public Enum PERMISSIONS As Integer

    NO_PERMISSION = &HFFFFF0C0

    ENABLE_PRINTING = &H4

    ENABLE_DOCUMENT_MODIFICATION = &H8

    ENABLE_COPYING_TEXT_GRAPHICS = &H10

    ENABLE_ADDING_CHANGING_NOTES = &H20

    ENABLE_ONLY_FILL_IN = &H100

    ENABLE_EXTRACTION = &H200

    ENABLE_ONLY_ASSEMBLY = &H400

    ENABLE_HIGH_QUALITY = &H800

End Enum

 

<Flags()>

Public Enum acFileNameOptions As Integer

    ' Please check FileNameOptions for the complete flags version

    NoPrompt = &H1

    UseFileName = &H2

    Concatenate = &H4

    DisableCompression = &H8

    EmbedFonts = &H10

    BroadcastMessages = &H20

    PrintWatermark = &H40

    EncryptDocument = &H100

    EncryptDocument128 = &H40000000

End Enum

Public Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"

    Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    Const AMYUNIPRINTERNAME As String = "Amyuni PDF Converter"

 

    ' Declare a new cdintfex object if it does not exist in the form.

    Dim PDF As New CDIntfEx.CDIntfEx

 

    ' Get a reference to the installed printer.

    ' This will fail if the printer name passed to the DriverInit method is 

    ' not found in the printer’s folder

    PDF.DriverInit(AMYUNIPRINTERNAME)

 

    ' The SetDefaultPrinter function sets the system default printer to the one

    ' initialized by the DriverInit functions.

    PDF.SetDefaultPrinter()

 

    ' The EnablePrinter() method needs to be called right before each print job.

    ' and before the configuration

    ' Calling the EnablePrinter() method will start a 20 second time-out value

    PDF.EnablePrinter(strLicenseTo, strActivationCode)

 

    ' Resulting PDF document stored here

    PDF.DefaultDirectory = "C:\Temp"

 

    ' Set Printer options

    PDF.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.EncryptDocument128

 

    ' Set OwnerPassword

    PDF.OwnerPassword = "owner123"

 

    ' Set UserPassword

    PDF.UserPassword = "user123"

 

    ' Set Permissions

    PDF.Permissions = PERMISSIONS.NO_PERMISSION Or PERMISSIONS.ENABLE_PRINTING Or PERMISSION.ENABLE_HIGH_QUALITY

 

    ' Apply Settings

    PDF.SetDefaultConfig()

 

    ' The BatchConvert method converts a number of files to PDF.

    PDF.BatchConvert("C:\Temp\*.docx")

 

    ' The RestoreDefaultPrinter function resets the system default printer 

    ' to the printer that was the default before the call to SetDefaultPrinter.

    PDF.RestoreDefaultPrinter()

 

    ' This function will simply detach from an existing printer because the handle was created using DriverInit

    PDF.DriverEnd()

End Sub

[Flags]

public enum PERMISSIONS

{

    NO_PERMISSION = unchecked((int)0xFFFFF0C0),

    ENABLE_PRINTING = 0x4,

    ENABLE_DOCUMENT_MODIFICATION = 0x8,

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10,

    ENABLE_ADDING_CHANGING_NOTES = 0x20,

    ENABLE_ONLY_FILL_IN = 0x100,

    ENABLE_EXTRACTION = 0x200,

    ENABLE_ONLY_ASSEMBLY = 0x400,

    ENABLE_HIGH_QUALITY = 0x800

}

 

[Flags]

public enum acFileNameOptions

{

    // Please check FileNameOptions for the complete flags version

    NoPrompt = 0x00000001,

    UseFileName = 0x00000002,

    Concatenate = 0x00000004,

    DisableCompression = 0x00000008,

    EmbedFonts = 0x00000010,

    BroadcastMessages = 0x00000020,

    PrintWatermark = 0x00000040,

    EncryptDocument = 0x00000100,

    EncryptDocument128 = 0x40000000

}

 

public void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Converter Evaluation";

    const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

    const string AMYUNIPRINTERNAME = "Amyuni PDF Converter";

 

    // Declare a new cdintfex object if it does not exist in the form.

    CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    PDF.DriverInit(AMYUNIPRINTERNAME);

 

    // The SetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    PDF.SetDefaultPrinter();

 

    // The EnablePrinter() method needs to be called right before each print job.

    // and before the configuration

    // Calling the EnablePrinter() method will start a 20 second time-out value

    PDF.EnablePrinter(strLicenseTo, strActivationCode);

 

    // Resulting PDF document stored here

    PDF.DefaultDirectory = @"C:\Temp";

 

    // Set Printer options

    PDF.FileNameOptionsEx = (int)(acFileNameOptions.NoPrompt | acFileNameOptions.EncryptDocument128);

 

    // Set OwnerPassword

    PDF.OwnerPassword = "owner123";

 

    // Set UserPassword

    PDF.UserPassword = "user123";

 

    // Set Permissions

    PDF.Permissions = (int)(PERMISSIONS.NO_PERMISSION | PERMISSIONS.ENABLE_PRINTING | PERMISSIONS.HIGH_QUALITY));

 

    // Apply Settings

    PDF.SetDefaultConfig();

 

    // The BatchConvert method converts a number of files to PDF.

    PDF.BatchConvert(@"C:\Temp\*.docx");

 

    // The RestoreDefaultPrinter function resets the system default printer 

    // to the printer that was the default before the call to SetDefaultPrinter.

    PDF.RestoreDefaultPrinter();

 

    // This function will simply detach from an existing printer because the handle was created using DriverInit

    PDF.DriverEnd();

}

// PDF Converter Cpp.cpp : Defines the entry point for the console application.

// 

# include <Windows.h>

# include <string>

# include <iostream>

# include "CdIntf.h"

# pragma comment (lib, "CDIntf.lib")

 

using namespace std;

 

enum PERMISSIONS 

{

    NO_PERMISSION = 0xFFFFF0C0,

    ENABLE_PRINTING = 0x4,

    ENABLE_DOCUMENT_MODIFICATION = 0x8,

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10,

    ENABLE_ADDING_CHANGING_NOTES = 0x20,

    ENABLE_ONLY_FILL_IN = 0x100,

    ENABLE_EXTRACTION = 0x200,

    ENABLE_ONLY_ASSEMBLY = 0x400,

    ENABLE_HIGH_QUALITY = 0x800

};

 

int main()

{

     // Constants for Activation codes

    #define strLicenseTo  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    #define AMYUNIPRINTERNAME "Amyuni PDF Converter"

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);

 

    // The CDISetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    CDISetDefaultPrinter(PDF);

 

    // The EnablePrinter() method needs to be called right before each print job.

    // and before the configuration

    // Calling the EnablePrinter() method will start a 20 second time-out value

    EnablePrinter(PDF, strLicenseTo, strActivationCode);

 

    // Resulting PDF document stored here

    SetDefaultDirectory(PDF, "C:\temp");

 

    // Set Printer options

    SetFileNameOptions(PDF, NoPrompt | EncryptDocument128);

 

    // Set OwnerPassword

    SetOwnerPassword(PDF, "owner123");

 

    // Set UserPassword

    SetUserPassword(PDF, "user123";

 

    // Set Permissions

    SetPermissions(PERMISSIONS::NO_PERMISSION | PERMISSIONS::ENABLE_PRINTING | PERMISSIONS::ENABLE_HIGH_QUALITY);

 

    // The BatchConvert method converts a number of files to PDF.

    BatchConvertEx(PDF, "C:\temp\\*.docx");

 

    // The RestoreDefaultPrinter function resets the system default printer 

    // to the printer that was the default before the call to SetDefaultPrinter.

    RestoreDefaultPrinter(PDF);

 

    // This function will simply detach from an existing printer because the handle was created using DriverInit

    DriverEnd(PDF);    

 

    // Destroy PDF object

    PDF = nullptr;    

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

 

public class Sample {

    public enum PERMISSIONS 

    {

        NO_PERMISSION (0xFFFFF0C0),

        ENABLE_PRINTING (0x4),

        ENABLE_DOCUMENT_MODIFICATION (0x8),

        ENABLE_COPYING_TEXT_GRAPHICS (0x10),

        ENABLE_ADDING_CHANGING_NOTES (0x20)

        ENABLE_ONLY_FILL_IN (0x100),

        ENABLE_EXTRACTION (0x200),

        ENABLE_ONLY_ASSEMBLY (0x400),

        ENABLE_HIGH_QUALITY (0x800);

        public int value;

        public PERMISSIONS(int value)

        {

            this.value = value;

        }

        public Object value(){

            return value;

        }

    }

 

    public enum acFileNameOptions

    {

        // Please check FileNameOptions for the complete flags version

        NoPrompt(0x00000001),

        UseFileName(0x00000002),

        Concatenate(0x00000004),

        DisableCompression(0x00000008),

        EmbedFonts(0x00000010),

        BroadcastMessages(0x00000020),

        PrintWatermark(0x00000040),

        EncryptDocument(0x00000100),

        EncryptDocument128(0x40000000);

        public int value;

        public acFileNameOptions(int value)

        {

            this.value = value;

        }

        public Object value(){

            return value;

        }

    }

 

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "Amyuni PDF Converter Evaluation";

        String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

        String AMYUNIPRINTERNAME = "Amyuni PDF Converter";

 

        // Declare a new cdintfex object if it does not exist in the form.

        ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5"); 

 

        // Get a reference to the installed printer.

        // This will fail if the printer name passed to the DriverInit method is 

        // not found in the printer’s folder

        Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);

 

        // The SetDefaultPrinter function sets the system default printer to the one

        // initialized by the DriverInit functions.

        Dispatch.call(pdf,"SetDefaultPrinter");

 

        // The EnablePrinter() method needs to be called right before each print job.

        // and before the configuration

        // Calling the EnablePrinter() method will start a 20 second time-out value

        Dispatch.call(pdf,"EnablePrinter", strLicenseTo, strActivationCode);

 

        // Resulting PDF document stored here

        Dispatch.put(pdf,"DefaultDirectory","C:\temp");

 

        // Set Printer options

        Dispatch.put(pdf,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.EncryptDocument128.value );

 

        // Set OwnerPassword

        Dispatch.call(pdf,"OwnerPassword", "owner123");

 

        // Set UserPassword

        Dispatch.call(pdf,"UserPassword", "user123");

 

        // Set Permissions

        Dispatch.call(pdf,"Permissions", PERMISSIONS.NO_PERMISSION.value + PERMISSIONS.ENABLE_PRINTING.value + PERMISSIONS.ENABLE_HIGH_QUALITY.value);

 

        // The BatchConvert method converts a number of files to PDF.

        Dispatch.call(pdf,"BatchConvert","C:\temp\\*.docx");

 

        // The RestoreDefaultPrinter function resets the system default printer 

        // to the printer that was the default before the call to SetDefaultPrinter.

        Dispatch.call(pdf,"RestoreDefaultPrinter"); 

 

        // This function will simply detach from an existing printer because the handle was created using DriverInit

        Dispatch.call(pdf,"DriverEnd");

 

        // Destroy PDF object

        pdf = null;        

    }

}

$PERMISSIONS = @{

    NO_PERMISSION = 0xFFFFF0C0

    ENABLE_PRINTING = 0x4

    ENABLE_DOCUMENT_MODIFICATION = 0x8

    ENABLE_COPYING_TEXT_GRAPHICS = 0x10

    ENABLE_ADDING_CHANGING_NOTES = 0x20

    ENABLE_ONLY_FILL_IN = 0x100

    ENABLE_EXTRACTION = 0x200

    ENABLE_ONLY_ASSEMBLY = 0x400

    ENABLE_HIGH_QUALITY = 0x800

}

 

$acFileNameOptions = @{

    NoPrompt = 0x00000001

    UseFileName = 0x00000002

    Concatenate = 0x00000004

    DisableCompression = 0x00000008

    EmbedFonts = 0x00000010

    BroadcastMessages = 0x00000020

    PrintWatermark = 0x00000040

    EncryptDocument = 0x00000100

    EncryptDocument128 = 0x40000000

 

# Please check FileNameOptions for the complete flags version

 

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

$AMYUNIPRINTERNAME = "Amyuni PDF Converter"

 

# Declare a new cdintfex object if it does not exist in the form.

$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5

 

# Get a reference to the installed printer.

# This will fail if the printer name passed to the DriverInit method is 

# not found in the printer’s folder

[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME) 

 

# The SetDefaultPrinter function sets the system default printer to the one

# initialized by the DriverInit functions.

[System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)

 

# The EnablePrinter()method needs to be called right before each print job.

# and before the configuration

# Calling the EnablePrinter()method will start a 20 second time-out value

[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))

 

# Resulting PDF document stored here

[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,"C:\Temp") 

 

# Set Printer options

[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acFileNameOptions::NoPrompt -bOr $acFileNameOptions::EncryptDocument128)

 

# Set OwnerPassword

[System.__ComObject].InvokeMember('OwnerPassword', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "owner123")

 

# Set UserPassword

[System.__ComObject].InvokeMember('UserPassword', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "user123")

 

# Set Permissions

[System.__ComObject].InvokeMember('Permissions', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $PERMISSIONS::NO_PERMISSION -bOr $PERMISSIONS::ENABLE_PRINTING -bOr $PERMISSIONS::ENABLE_HIGH_QUALITY)

 

# The BatchConvert method converts a number of files to PDF.

[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "C:\Temp\*.docx")

 

# The RestoreDefaultPrinter function resets the system default printer 

# to the printer that was the default before the call to SetDefaultPrinter.

[System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null) 

 

# This function will simply detach from an existing printer because the handle was created using DriverInit 

[System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null) 

 

# Destroy PDF object

$PDF = $null

' Permissions

Const NO_PERMISSION = -3904

Const ENABLE_PRINTING = 4

Const ENABLE_DOCUMENT_MODIFICATION = 8

Const ENABLE_COPYING_TEXT_GRAPHICS = 16

Const ENABLE_ADDING_CHANGING_NOTES = 32

Const ENABLE_ONLY_FILL_IN = 256

Const ENABLE_EXTRACTION = 512

Const ENABLE_ONLY_ASSEMBLY = 1024

Const ENABLE_HIGH_QUALITY = 2048

 

' FileNameOptions constants

' Please check FileNameOptions for the complete flags version

Const NoPrompt = &H1

Const UseFileName = &H2

Const Concatenate = &H4

Const DisableCompression = &H8

Const EmbedFonts = &H10

Const BroadcastMessages = &H20

Const PrintWatermark = &H40

Const MultilingualSupport = &H80

Const EncryptDocument = &H100

Const EncryptDocument128 = &H40000000

 

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

Const AMYUNIPRINTERNAME = "Amyuni PDF Converter"

 

' Declare a new cdintfex object

Dim PDF

Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")

 

' Get a reference to the installed printer.

' This will fail if the printer name passed to the DriverInit method is

' not found in the printer’s folder

PDF.DriverInit AMYUNIPRINTERNAME

 

' The SetDefaultPrinter function sets the system default printer to the one

' initialized by the DriverInit functions.

PDF.SetDefaultPrinter

 

' The EnablePrinter() method needs to be called right before each print job.

' and before the configuration

' Calling the EnablePrinter() method will start a 20 second time-out value

PDF.EnablePrinter strLicenseTo, strActivationCode

 

' Resulting PDF document stored here

PDF.DefaultDirectory = "C:\Temp"

 

' Set Printer options

PDF.FileNameOptionsEx = NoPrompt Or EncryptDocument128

 

' Set OwnerPassword

PDF.OwnerPassword = "owner123"

 

' Set UserPassword

PDF.UserPassword = "user123"

 

' Set Permissions

PDF.Permissions = NO_PERMISSION + ENABLE_PRINTING + ENABLE_HIGH_QUALITY

 

' Apply Settings

PDF.SetDefaultConfig

 

' The BatchConvert method converts a number of files to PDF.

PDF.BatchConvert "C:\Temp\*.docx"

 

' The RestoreDefaultPrinter function resets the system default printer

' to the printer that was the default before the call to SetDefaultPrinter.

PDF.RestoreDefaultPrinter

 

' This function will simply detach from an existing printer because the handle was created using DriverInit

PDF.DriverEnd

 

' Destroy PDF object

Set PDF = Nothing