The SetDocEmailProps method can be used in multi-threading situations to avoid conflicts between multiple applications or multiple threads requesting simultaneous access the Converter products. The CDIntf library uses the registry to interact with the printer drivers. This can cause conflicts when multiple applications use CDIntf to access the printer drivers.
Refer to the documentation for the Lock and the Unlock methods for further clarification.
System.Int32 SetDocEmailProps(System.String szDocTitle, System.String szTO, System.String szCC, System.String szBCC, System.String szSubject, System.String szMessage, System.Int32 lPrompt)
System.Int32 SetDocEmailPropsEx(System.String szDocTitle, System.String szSmtpServer, System.Int32 lSmtpPort, System.String szFrom, System.String szTO, System.String szCC, System.String szBCC, System.String szSubject, System.String szMessage, System.Int32 lFlags)
System.Int32 SetDocEmailPropsEx2(System.String szDocTitle, System.String szSmtpServer, System.Int32 lSmtpPort, System.String szSmtpUsername, System.String szSmtpPassword, System.String szFrom, System.String szTO, System.String szCC, System.String szBCC, System.String szSubject, System.String szMessage, System.Int32 lFlags)
szDocTitle
The document title as it appears in the print spooler when printing any document, this should be the same as the parameter szLockName used for Lock and Unlock.
szTo
Name and e-mail address of the e-mail destination. Multiple addresses can be specified by separating them with semi-colons (;).
szCC
Name and e-mail address of the e-mail Carbon Copy list. Multiple addresses can be specified by separating them with semi-colons (;).
szBCC
Handle Name and e-mail address of the e-mail Blind Carbon Copy list. Multiple addresses can be specified by separating them with semi-colons (;).
szSubject
Subject of the email. Some servers require to use UTF8: as prefix to support Unicode text.
szMessage
E-mail message
lPrompt
If true (1) prompt the user with a dialog box, otherwise (0) do things silently
szSmtpServer
Name or IP address of server used to send e-mails.
lSmtpPort
SMTP port number on server used to send e-mails. The default value is 25
szFrom
Name and e-mail address of the e-mail sender.
lFlags
Registry Entry |
Description |
---|---|
SMO_PROMPT_PROFILE |
Not used. |
SMO_PROMPT_RECIPIENT |
Prompt before sending MAPI e-mails. |
SMO_SMTP_MAIL |
Send e-mail by SMTP and not by MAPI. |
szSmtpUsername
Username for SMTP server.
szSmtpPassword
Password for SMTP server.
Returns 0 when successful, < 0 upon failure.
Some SMTP servers don't allow direct Unicode for the text of the SMTP header, only UTF8 encoding. In those cases, the UTF8: prefix must be used for the subject field. Ex: UTF8: Test subject ä ö ü Ä Ö Ü ß. However, the conversion only will applied if there is any Unicode symbol.
Member of CDIntfEx.CDIntfEx.
<Flags()>
Public Enum acFileNameOptions As Integer
' Please check FileNameOptions for the complete flags version
NoPrompt = &H1
UseFileName = &H2
EmbedFonts = &H10
BroadcastMessages = &H20
SendByEmail = &H800
End Enum
Public Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "DOCX Converter Developer Evaluation"
Const strActivationCode As String = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
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)
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
DOCX.SetDefaultPrinter()
' Resulting DOCX document stored here
DOCX.DefaultDirectory = "C:\Temp"
' Set Printer options
DOCX.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.SendByEmail
' The EnablePrinter() method needs to be called right before each print job.
' Calling the EnablePrinter() method will start a 20 second time-out value
DOCX.EnablePrinter(strLicenseTo, strActivationCode)
' Set SetDocEmailProps
DOCX.SetDocEmailProps("Email", "info@amyuni.com", "sales@amyuni.com", "", "Testing email capabilities",
"Please find attached the requested document\nin DOCX format.", 0)
' The BatchConvert method converts a number of files to DOCX.
DOCX.BatchConvert("C:\Temp\*.ppt")
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
DOCX.RestoreDefaultPrinter()
' This function will simply detach from an existing printer because the handle was created using DriverInit
DOCX.DriverEnd()
' Destroy DOCX object
DOCX = Nothing
End Sub
[Flags]
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete flags version
NoPrompt = 0x00000001,
UseFileName = 0x00000002,
EmbedFonts = 0x00000010,
BroadcastMessages = 0x00000020,
SendByEmail = 0x00000800
}
public void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "DOCX Converter Developer Evaluation";
const string strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";
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);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
DOCX.SetDefaultPrinter();
// Resulting DOCX document stored here
DOCX.DefaultDirectory = @"C:\Temp";
// Set Printer options
DOCX.FileNameOptionsEx =(int)(acFileNameOptions.NoPrompt | acFileNameOptions.SendByEmail);
// The EnablePrinter() method needs to be called right before each print job.
// Calling the EnablePrinter() method will start a 20 second time-out value
DOCX.EnablePrinter(strLicenseTo, strActivationCode);
// Set SetDocEmailProps
DOCX.SetDocEmailProps("Email", "info@amyuni.com", "sales@amyuni.com", "", "Testing email capabilities",
"Please find attached the requested document\nin DOCX format.", 0);
// The BatchConvert method converts a number of files to DOCX.
DOCX.BatchConvert(@"C:\Temp\*.ppt");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
DOCX.RestoreDefaultPrinter();
// This function will simply detach from an existing printer because the handle was created using DriverInit
DOCX.DriverEnd();
// Destroy DOCX object
DOCX = null;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
public class Sample {
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete flags version
NoPrompt(0x00000001),
UseFileName(0x00000002),
EmbedFonts(0x00000010),
BroadcastMessages(0x00000020);
SendByEmail(0x00000800);
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 = "DOCX Converter Developer Evaluation";
String strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";
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);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
Dispatch.call(docx,"SetDefaultPrinter");
// Resulting DOCX document stored here
Dispatch.put(docx,"DefaultDirectory","c:\\Temp");
// Set Printer options
Dispatch.put(docx,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.SendByEmail.value);
// The EnablePrinter() method needs to be called right before each print job.
// Calling the EnablePrinter() method will start a 20 second time-out value
Dispatch.call(docx,"EnablePrinter", strLicenseTo, strActivationCode);
// Set SetDocEmailProps
Dispatch.call(docx,"SetDocEmailProps", "Email", "info@amyuni.com", "sales@amyuni.com", "", "Testing email capabilities",
"Please find attached the requested document\nin DOCX format.", 0);
// The BatchConvert method converts a number of files to DOCX.
Dispatch.call(docx,"BatchConvert","c:\\Temp\\*.ppt");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
Dispatch.call(docx,"RestoreDefaultPrinter");
// This function will simply detach from an existing printer because the handle was created using DriverInit
Dispatch.call(docx,"DriverEnd");
// Destroy DOCX object
docx = null;
}
}
$acFileNameOptions = @{
NoPrompt = 0x00000001
UseFileName = 0x00000002
EmbedFonts = 0x00000010
BroadcastMessages = 0x00000020
SendByEmail = 0x00000800
}
#Please check FileNameOptions for the complete flags version
# Constants for Activation codes
$strLicenseTo = "DOCX Converter Developer Evaluation"
$strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
$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)
#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,$DOCX,$null)
#Resulting DOCX document stored here
[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$DOCX,"c:\\Temp")
#Set Printer options
[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$DOCX,
$acFileNameOptions::NoPrompt -bOr $acFileNameOptions::SendByEmail)
#The EnablePrinter() method needs to be called right before each print job.
#Calling the EnablePrinter() method will start a 20 second time-out value
[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, @($strLicenseTo, $strActivationCode))
#Set SetDocEmailProps
[System.__ComObject].InvokeMember('SetDocEmailProps', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,
@("Email", "info@amyuni.com", "sales@amyuni.com", "", "Testing email capabilities",
"Please find attached the requested document\nin DOCX format.", 0))
#The BatchConvert method converts a number of files to DOCX.
[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, "C:\Temp\*.ppt")
#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,$DOCX,$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,$DOCX,$null)
#Destroy DOCX object
$DOCX = $null
' FileNameOptions constants
' Please check FileNameOptions for the complete flags version
Const NoPrompt = &H1
Const UseFileName = &H2
Const EmbedFonts = &H10
Const BroadcastMessages = &H20
' Constants for Activation codes
Const strLicenseTo = "DOCX Converter Developer Evaluation"
Const strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
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
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
DOCX.SetDefaultPrinter
' Resulting DOCX document stored here
DOCX.DefaultDirectory = "C:\Temp"
' Set Printer options
DOCX.FileNameOptionsEx = NoPrompt Or SendByEmail
' The EnablePrinter() method needs to be called right before each print job.
' Calling the EnablePrinter() method will start a 20 second time-out value
DOCX.EnablePrinter strLicenseTo, strActivationCode
' Set SetDocEmailProps
DOCX.SetDocEmailProps "Email", "info@amyuni.com", "sales@amyuni.com", "", "Testing email capabilities", "Please find attached the requested document\nin DOCX format.", 0
' The BatchConvert method converts a number of files to DOCX.
DOCX.BatchConvert "C:\Temp\*.ppt"
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
DOCX.RestoreDefaultPrinter
' This function will simply detach from an existing printer because the handle was created using DriverInit
DOCX.DriverEnd
' Destroy docx object
Set DOCX = Nothing