The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files.
System.Int32 GetVersionInformation([out] System.Int32 CDIntfMajor, [out] System.Int32 CDIntfMinor, [out] System.Int32 PrinterDriverMajor, [out] System.Int32 PrinterDriverMinor)
long GetVersionInformation(HANDLE hIntf, [out] long *CDIntfMajor, [out] long *CDIntfMinor, [out] long *PrinterDriverMajor, [out] long *PrinterDriverMinor)
CDIntfMajor
Will contain the cdintf.dll major version.
CDIntfMinor
Will contain the cdintf.dll minor version.
PrinterDriverMajor
Will contain the printer driver major version.
PrinterDriverMinor
Will contain the printer driver minor version.
hIntf
Handle to printer returned by any of the DriverInit function calls.
It returns 0 if successful.
Member of CDIntfEx.CDIntfEx.
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"
' Constants
Const NoPrompt As Int32 = &H1 ' do not prompt for file name
' Declare a new cdintfex object if it doesn' t 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.
' Calling the EnablePrinter()method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode)
' The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files
Dim CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor As Integer
PDF.GetVersionInformation(CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor)
MsgBox("Version cdintf.dll: " + HIWORD(CDIntfMajor) + "." + LOWORD(CDIntfMajor) + "." + HIWORD(CDIntfMinor) + "." + LOWORD(CDIntfMinor))
MsgBox("Version Printer Driver: " + HIWORD(PrinterDriverMajor) + "." + LOWORD(PrinterDriverMajor) + "." + HIWORD(PrinterDriverMinor) + "." + LOWORD(PrinterDriverMinor))
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter()
' Close Printer
PDF.DriverEnd()
End Sub
Function HIWORD(lparam As Long) As String
' This is the HIWORD of the lParam:
Return (lparam \ &H10000 And &HFFFF&).ToString
End Function
Function LOWORD(lparam As Long) As String
' LOWORD now equals 65,535 or &HFFFF
Return (lparam And &HFFFF&).ToString
End Function
End Module
static 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.
// Calling the EnablePrinter() method will start a 20 second time-out value
// and before the configuration
PDF.EnablePrinter(strLicenseTo, strActivationCode);
// The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files
Int32 CDIntfMajor = 0;
Int32 CDIntfMinor = 0;
Int32 PrinterDriverMajor = 0;
Int32 PrinterDriverMinor = 0;
PDF.GetVersionInformation(ref CDIntfMajor, ref CDIntfMinor, ref PrinterDriverMajor, ref PrinterDriverMinor);
Console.WriteLine("Version cdintf.dll: " + HIWORD(CDIntfMajor) + "." + LOWORD(CDIntfMajor) + "." + HIWORD(CDIntfMinor) + "." + LOWORD(CDIntfMinor));
Console.WriteLine("Version Printer Driver: " + HIWORD(PrinterDriverMajor) + "." + LOWORD(PrinterDriverMajor) + "." + HIWORD(PrinterDriverMinor) + "." + LOWORD(PrinterDriverMinor));
// 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();
}
static string HIWORD(long lparam)
{
// This is the HIWORD of the lParam:
System.Int16 y = BitConverter.ToInt16(BitConverter.GetBytes(lparam), 2);
return y.ToString();
}
static string LOWORD(long lparam)
{
// This is the HIWORD of the lParam:
System.Int16 y = BitConverter.ToInt16(BitConverter.GetBytes(lparam), 0);
return y.ToString();
}
// 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;
int main()
{
// Constants for Activation codes
#define strLicenseTo "Amyuni PDF Converter Evaluation"
#define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
#define AMYUNI_PRINTER_NAME "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(AMYUNI_PRINTER_NAME);
// 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.
// Calling the EnablePrinter()method will start a 20 second time-out value
EnablePrinter(PDF, strLicenseTo, strActivationCode);
// The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files
long CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor;
GetVersionInformation(PDF, &CDIntfMajor, &CDIntfMinor, &PrinterDriverMajor, &PrinterDriverMinor);
cout << "Version cdintf.dll: " << HIWORD(CDIntfMajor) << "." << LOWORD(CDIntfMajor) << "." << HIWORD(CDIntfMinor) << "." << LOWORD(CDIntfMinor) << endl;
cout << "Version Printer Driver: " << HIWORD(PrinterDriverMajor) << "." << LOWORD(PrinterDriverMajor) << "." << HIWORD(PrinterDriverMinor) << "." << LOWORD(PrinterDriverMinor) << endl;
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
RestoreDefaultPrinter(PDF);
// Close Printer
DriverEnd(PDF);
// Destroy PDF object
PDF = nullptr;
return 0;
}
function HIWORD
{
[bitconverter]::ToInt16([bitconverter]::GetBytes($args[0]),2)
}
function LOWORD
{
[bitconverter]::ToInt16([bitconverter]::GetBytes($args[0]),0)
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
$AMYUNIPRINTERNAME = "Amyuni PDF Converter"
#Declare a new cdintfex object if it doesn' t exist in the form.
$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5
#The function will first attempt to connect to an existing printer.
#If it does not find any printer with the name provided by PrinterName,
#it will attempt to install a new printer.
$dummyvar = [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.
$dummyvar = [System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
#The EnablePrinter()method needs to be called right before each print job.
#Calling the EnablePrinter()method will start a 20 second time-out value
$dummyvar = [System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))
#The BatchConvert method converts a number of files to PDF.
$paramMod = new-object -type System.Reflection.ParameterModifier(4)
$paramMod[0] = $true
$paramMod[1] = $true
$paramMod[2] = $true
$paramMod[3] = $true
$CDIntfMajor = 0
$CDIntfMinor = 0
$PrinterDriverMajor = 0
$PrinterDriverMinor = 0
$methodArgs =@($CDIntfMajor, $CDIntfMinor, $PrinterDriverMajor, $PrinterDriverMinor)
$dummyvar = [System.__ComObject].InvokeMember('GetVersionInformation', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $methodArgs, $paramMod, $null, $null)
echo "Version cdintf.dll:"
echo (HIWORD $methodArgs[0]),(LOWORD $methodArgs[0]), (HIWORD $methodArgs[1]),(LOWORD $methodArgs[1])
echo "Version Printer Driver:"
echo (HIWORD $methodArgs[2]),(LOWORD $methodArgs[2]), (HIWORD $methodArgs[3]),(LOWORD $methodArgs[3])
#The RestoreDefaultPrinter function resets the system default printer
#to the printer that was the default before the call to SetDefaultPrinter.
$dummyvar = [System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
#This function will attempt to remove the printer because the handle was created using PDFDriverInit
$dummyvar = [System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
#Destroy PDF object
$PDF = $null