PrinterParamStr and PrinterParamInt

The PrinterParamStr and PrinterParamInt properties are used to set or read custom printer parameters.

 

Syntax

ActiveX:

System.String GetPrinterParamStr(System.String PrinterParam);
System.Int32 GetPrinterParamInt(System.String PrinterParam);

void SetPrinterParamStr(System.String PrinterParam, System.String Value)
void SetPrinterParamInt(System.String PrinterParam, System.Int32  Value)

DLL:

int SetPrinterParamStr( HANDLE hPrinter, LPCSTR szParam, LPCSTR szValue )
int SetPrinterParamStrW( HANDLE hPrinter, LPCSTR szParam, LPCWSTR szValue )
int GetPrinterParamStr( HANDLE hPrinter, LPCSTR szParam, LPSTR szValue, int nLen )

int SetPrinterParamInt(HANDLE hPrinter, LPCSTR szParam, long nValue)
long GetPrinterParamInt(HANDLE hPrinter, LPCSTR szParam)

 

Parameters

PrinterParamStr

[in, out] String value of the parameter if the parameter is of type string.

PrinterParamInt

[in, out] Long integer value of the parameter if the parameter is of type integer.

PrinterParam, szParam

Name of parameter to change. The comments section contains a list of valid names.

Value, szValue

[in, out] String value of the parameter if the parameter is of type string.  It should be an Ansi string for SetPrinterParamStr or a Unicode string for SetPrinterParamStrW.

hPrinter

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

nLen

Size of the szValue buffer where the string value should be returned.

nValue

Long integer value of the parameter if the parameter is of type integer.

 

Remarks

Member of CDIntfEx.CDIntfEx.

 

Example

Activation PostProcessing

 

<Flags()>

Public Enum acFileNameOptions As Integer

    NoPrompt = &H1

    UseFileName = &H2

    Concatenate = &H4

    DisableCompression = &H8

    EmbedFonts = &H10

    BroadcastMessages = &H20

    MultilingualSupport = &H80

    EncryptDocument = &H100

    FullEmbed = &H200

    UseTcpIpServer = &H400

    SendByEmail = &H800

    ConfirmOverwrite = &H1000

    AppendExisting = &H2000

    AddDateTime = &H3000

    AddIdNumber = &H4000

    LinearizeForWeb = &H8000

    PostProcessing = &H10000

End Enum

 

Sub Sample()

    ' Constants for Activation codes

    Const AMYUNIPRINTERNAME As String = "Amyuni DOCX Converter"

 

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

    Dim DOCX 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

    DOCX.DriverInit(AMYUNIPRINTERNAME)

 

    ' Tells Amyuni DOCX Converter to Call a viewer after printing

    Dim viewerExe As String = "C:\Program Files(x86)\Microsoft Office\Office12\Winword.exe"

    DOCX.SetPrinterParamStr("PostProcessing", viewerExe)

 

    ' Enable PostProcessing

    DOCX.FileNameOptionsEx = acFileNameOptions.PostProcessing

 

    ' Destroy the docx object

    DOCX = Nothing

End Sub

[Flags]

public enum acFileNameOptions

{

    NoPrompt = 0x00000001,

    UseFileName = 0x00000002,

    Concatenate = 0x00000004,

    DisableCompression = 0x00000008,

    EmbedFonts = 0x00000010,

    BroadcastMessages = 0x00000020,

    MultilingualSupport = 0x00000080,

    EncryptDocument = 0x00000100,

    FullEmbed = 0x00000200,

    UseTcpIpServer = 0x00000400,

    SendByEmail = 0x00000800,

    ConfirmOverwrite = 0x00001000,

    AppendExisting = 0x00002000,

    AddDateTime = 0x00003000,

    AddIdNumber = 0x00004000,

    LinearizeForWeb = 0x00008000,

    PostProcessing = 0x00010000

}

 

static void Sample()

{

    // Constants for Activation codes

    const string AMYUNIPRINTERNAME = "Amyuni DOCX Converter";

 

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

    CDIntfEx.CDIntfEx DOCX = 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

    DOCX.DriverInit(AMYUNIPRINTERNAME);

 

    // Tells Amyuni DOCX Converter to Call a viewer after printing

    string viewerExe = "C:\\Program Files(x86)\\Microsoft Office\\Office12\\Winword.exe";

    DOCX.SetPrinterParamStr("PostProcessing", viewerExe);

 

    // Enable PostProcessing

    DOCX.FileNameOptionsEx =(int)acFileNameOptions.PostProcessing;

 

    // Destroy the docx object

    DOCX = null;

}

// DOCX 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;

 

 

int main()

{

    // Constants for Activation codes

#define AMYUNIPRINTERNAME "Amyuni DOCX 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 DOCX = DriverInit(AMYUNIPRINTERNAME);

 

    // Tells Amyuni DOCX Converter to Call a viewer after printing

    LPCSTR viewerExe = "C:\\Program Files(x86)\\Microsoft Office\\Office12\\Winword.exe";

    SetPrinterParamStr(DOCX, "PostProcessing", viewerExe);

 

    // Enable PostProcessing

    SetFileNameOptions(DOCX, PostProcessing);

 

    // Destroy docx object

    DOCX = NULL;

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

import com.jacob.com.Variant;

 

public class PrinterParam {

 

    public enum acFileNameOptions

    {

        NoPrompt(0x00000001),

        UseFileName(0x00000002),

        Concatenate(0x00000004),

        DisableCompression(0x00000008),

        EmbedFonts(0x00000010),

        BroadcastMessages(0x00000020);

        MultilingualSupport(0x00000080),

        EncryptDocument(0x00000100),

        FullEmbed(0x00000200),

        UseTcpIpServer(0x00000400),

        SendByEmail(0x00000800),

        ConfirmOverwrite(0x00001000),

        AppendExisting(0x00002000),

        AddDateTime(0x00003000),

        AddIdNumber(0x00004000),

        LinearizeForWeb(0x00008000),

        PostProcessing(0x00010000);

        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 AMYUNIPRINTERNAME = "Amyuni DOCX Converter";

 

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

        ActiveXComponent docx = 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(docx,"DriverInit", AMYUNIPRINTERNAME);

 

        // Tells Amyuni DOCX Converter to Call a viewer after printing

        string viewerExe = "C:\\Program Files(x86)\\Microsoft Office\\Office12\\Winword.exe";

        Dispatch.put(docx, "SetPrinterParamStr", "PostProcessing", viewerExe);

 

        // Enable PostProcessing

        Dispatch.put(docx,"FileNameOptionsEx", acFileNameOptions.PostProcessing.value);

 

        // Destroy the docx object

        DOCX = null;

 

    }

}

$acFileNameOptions = @{

    NoPrompt = 0x00000001

    UseFileName = 0x00000002

    Concatenate = 0x00000004

    DisableCompression = 0x00000008

    EmbedFonts = 0x00000010

    BroadcastMessages = 0x00000020

    MultilingualSupport = 0x00000080

    EncryptDocument = 0x00000100

    FullEmbed = 0x00000200

    UseTcpIpServer = 0x00000400

    SendByEmail = 0x00000800

    ConfirmOverwrite = 0x00001000

    AppendExisting = 0x00002000

    AddDateTime = 0x00003000

    AddIdNumber = 0x00004000

    LinearizeForWeb = 0x00008000

    PostProcessing = 0x00010000

}

 

# Constants for Activation codes

$AMYUNIPRINTERNAME = "Amyuni DOCX Converter"

 

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

$DOCX = 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,$DOCX,$AMYUNIPRINTERNAME)

 

#Tells Amyuni DOCX Converter to Call a viewer after printing

$viewerExe = "C:\Program Files(x86)\Microsoft Office\Office12\Winword.exe"

[System.__ComObject].InvokeMember('SetPrinterParamStr', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, @("PostProcessing", $viewerExe))

 

#Enable PostProcessing

[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$DOCX,$acFileNameOptions::PostProcessing)

 

#Destroy the docxCreator object

$DOCX = $null

' FileNameOptions constants

Const NoPrompt = &H1

Const UseFileName = &H2

Const Concatenate = &H4

Const DisableCompression = &H8

Const EmbedFonts = &H10

Const BroadcastMessages = &H20

Const MultilingualSupport = &H80

Const EncryptDocument = &H100

Const FullEmbed = &H200

Const UseTcpIpServer = &H400

Const SendByEmail = &H800

Const ConfirmOverwrite = &H1000

Const AppendExisting = &H2000

Const AddDateTime = &H3000

Const AddIdNumber = &H4000

Const LinearizeForWeb = &H8000

Const PostProcessing = &H10000

 

' Constants for Activation codes

Const AMYUNIPRINTERNAME = "Amyuni DOCX Converter"

 

' Declare a new cdintfex object

Dim DOCX

Set DOCX = 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

DOCX.DriverInit AMYUNIPRINTERNAME

 

' Tells Amyuni DOCX Converter to Call a viewer after printing

Dim viewerExe

viewerExe= "C:\Program Files(x86)\Microsoft Office\Office12\Winword.exe"

DOCX.SetPrinterParamStr "PostProcessing", viewerExe

 

' Enable PostProcessing

 

DOCX.FileNameOptionsEx = PostProcessing

 

' Destroy docx object

Set DOCX = Nothing

 

ACTIVATION ERROR REPORTING:

Custom parameters for Activation Error Reporting

Parameter

Type

Description

Values

Activation Error Title

String

Custom title of the message box upon an activation error.

Any String

Activation Error Text

String

Custom text of the message box upon an activation error.

Any String

Example

Sub Sample()

    ' Constants for Activation codes

    Const AMYUNIPRINTERNAME As String = "Amyuni DOCX Converter"

 

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

    Dim DOCX 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

    DOCX.DriverInit(AMYUNIPRINTERNAME)

 

    ' Set the Parameters

    DOCX.SetPrinterParamStr("Activation Error Title", "Your error title here")

    DOCX.SetPrinterParamStr("Activation Error Text", "Your error message here")

 

    ' Destroy the docx object

    DOCX = Nothing

End Sub

static void Sample()

{

    // Constants for Activation codes

    const string AMYUNIPRINTERNAME = "Amyuni DOCX Converter";

 

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

    CDIntfEx.CDIntfEx DOCX = 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

    DOCX.DriverInit(AMYUNIPRINTERNAME);

 

    // Set the Parameters

    DOCX.SetPrinterParamStr("Activation Error Title", "Your error title here");

    DOCX.SetPrinterParamStr("Activation Error Text", "Your error message here");

 

    // Destroy the docx object

    DOCX = null;

}

// DOCX 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;

 

 

int main()

{

     // Constants for Activation codes

    #define AMYUNIPRINTERNAME "Amyuni DOCX 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 DOCX = DriverInit(AMYUNIPRINTERNAME);

 

    // Set the Parameters

    SetPrinterParamStr(DOCX, "Activation Error Title", "Your error title here");

    SetPrinterParamStr(DOCX, "Activation Error Text", "Your error message here");

 

    // Destroy docx object

    DOCX = NULL;

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

 

public class Sample {

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String AMYUNIPRINTERNAME = "Amyuni DOCX Converter";

 

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

        ActiveXComponent docx = 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(docx,"DriverInit", AMYUNIPRINTERNAME);

 

        // Set the Parameters

        Dispatch.call(docx, "SetPrinterParamStr", "Activation Error Title", "Your error title here");

        Dispatch.call(docx, "SetPrinterParamStr", "Activation Error Text", "Your error message here");

 

        // Destroy docxCreator Object

        docx = null;

    }

}

# Constants for Activation codes

$AMYUNIPRINTERNAME = "Amyuni DOCX Converter"

 

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

$DOCX = 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,$DOCX,$AMYUNIPRINTERNAME)

 

#Set the Parameters

[System.__ComObject].InvokeMember('SetPrinterParamStr', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, @("Activation Error Title", "Your error title here"))

[System.__ComObject].InvokeMember('SetPrinterParamStr', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, @("Activation Error Text", "Your error message here"))

 

#Destroy the docxCreator object

$DOCX = $null

' Constants for Activation codes

Const AMYUNIPRINTERNAME = "Amyuni DOCX Converter"

 

' Declare a new cdintfex object

Dim DOCX

Set DOCX = 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

DOCX.DriverInit AMYUNIPRINTERNAME

 

' Set up the Parameters

DOCX.SetPrinterParamStr "Activation Error Title", "Your error title here"

DOCX.SetPrinterParamStr "Activation Error Text", "Your error message here"

 

' Destroy docx object

Set DOCX = Nothing