ColorProfile

The SetColorProfile property is used to attach a color profile to the Document Converter printer.

 

Syntax

ActiveX:

System.Boolean SetColorProfile(System.String ProfileName)

DLL:

int SetColorProfile(HANDLE hPrinter, LPCSTR szColorProfile);

 

Parameters

ProfileName, szColorProfile

Name of the color profile to be attached.

hPrinter

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

 

Return Value

This property returns True for success and False on failure

 

Remarks

To generate DOCX files with CMYK content, a color profile should be attached to the printer; this can be done either manually from the printers’ panel, or through the CDIntfEx.SetColorProfile helper function.

The ICC profile is usually supplied by the printer manufacturer. Microsoft provides a standard CMYK ICC profile that can be used; the Microsoft profile is located under:

http://www.microsoft.com/whdc/device/display/color/CMYK_Profile.mspx

 

Amyuni also provides a standard CMYK profile under:

https://www.amyuni.com/downloads/AmyuniCMYK.icc

 

The best color profile remains the one supplied by the printer manufacturer of the destination printer.

 

ProfileName can be either the name of the profile with the extension(e.g. AmyuniCMYK.icc)if the color profile is already installed on the system, or the full path to where the profile is located.

In addition to attaching a color profile, the DOCX printer should be configured for CMYK conversion by using IO_CONVERTTOCMYK in ImageOptions property.

 

Member of CDIntfEx.CDIntfEx.

 

Example

<Flags()>
Public Enum acFileNameOptions As Integer
    ' Please check FileNameOptions for the complete flags version
    NoPrompt = &H1
    UseFileName = &H2
    EmbedFonts = &H10
    BroadcastMessages = &H20
End Enum
 
<Flags()>
Public Enum acImageOptions As Integer
    IO_NODUPLICATES = &H1
    IO_DOWNSAMPLE = &H2
    IO_CONVERTTOCMYK = &H4
    IO_OUTPUTDOCXA = &H8
    IO_XMPMETADATA = &H10
    IO_OUTPUTDOCXA8 = &H20
    IO_NOPRECOMPRESSED = &H40
    IO_OUTPUTDOCXX1 = &H80
    IO_OUTPUTDOCXX3 = &H100
    IO_COMPRESSJBIG2 = &H200
    IO_ENABLEEPS = &H40000000
    IO_SIMPOSTSCRIPT = &H80000000
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
 
    ' 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 Image conversion options in IO_CONVERTTOCMYK (Mandatory)
    DOCX.ImageOptions = acImageOptions.IO_CONVERTTOCMYK
 
    ' Set the ColorProfile option locate in %WINDIR%\system32\spool\drivers\color
    DOCX.SetColorProfile("AmyuniCMYK")
 
    ' Apply Settings
    DOCX.SetDefaultConfig()
 
    ' 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,
}
 
 [Flags]
public enum acImageOptions
{
    IO_NODUPLICATES = 0x00000001,
    IO_DOWNSAMPLE = 0x00000002,
    IO_CONVERTTOCMYK = 0x00000004,
    IO_OUTPUTDOCXA = 0x00000008,
    IO_XMPMETADATA = 0x00000010,
    IO_OUTPUTDOCXA8 = 0x00000020,
    IO_NOPRECOMPRESSED = 0x00000040,
    IO_OUTPUTDOCXX1 = 0x00000080,
    IO_OUTPUTDOCXX3 = 0x00000100,
    IO_COMPRESSJBIG2 = 0x00000200 ,
    IO_ENABLEEPS = 0x40000000 ,
    IO_SIMPOSTSCRIPT = unchecked((int)0x80000000)
}
 
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;
 
    // 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 Image conversion options in IO_CONVERTTOCMYK (Mandatory)
    DOCX.ImageOptions =(int)acImageOptions.IO_CONVERTTOCMYK;
 
    // Set the ColorProfile option locate in %WINDIR%\system32\spool\drivers\color
    DOCX.SetColorProfile("AmyuniCMYK");
 
    // Apply Settings
    DOCX.SetDefaultConfig();
 
    // 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;    
}
// 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 strLicenseTo  "DOCX Converter Developer Evaluation"
    #define strActivationCode "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
    #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);
 
    // The CDISetDefaultPrinter function sets the system default printer to the one
    // initialized by the DriverInit functions.
    CDISetDefaultPrinter(DOCX);
 
    // Resulting DOCX document stored here
    SetDefaultDirectory(DOCX, "c:\\Temp");
 
    // Set Printer options
    SetFileNameOptions(DOCX, NoPrompt);
 
    // 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(DOCX, strLicenseTo, strActivationCode);
 
    // Set Image conversion options in IO_CONVERTTOCMYK (Mandatory)
    SetImageOptions(DOCX, IO_CONVERTTOCMYK);
 
    // Set the ColorProfile option locate in %WINDIR%\system32\spool\drivers\color
    SetColorProfile(DOCX, "AmyuniCMYK");
 
    // Apply Settings
    SetDefaultConfig(DOCX);
 
    // The BatchConvert method converts a number of files to DOCX.
    BatchConvertEx(DOCX, "c:\\Temp\\*.ppt");
 
    // The RestoreDefaultPrinter function resets the system default printer 
    // to the printer that was the default before the call to SetDefaultPrinter.
    RestoreDefaultPrinter(DOCX);
 
    // This function will simply detach from an existing printer because the handle was created using DriverInit
    DriverEnd(DOCX);    
 
    // Destroy DOCX object
    DOCX = NULL;    
 
    return 0;
}
package Example;
 
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
 
public class Sample {
    public enum acImageOptions
    {
        // Please check FileNameOptions for the complete flags version
        IO_NODUPLICATES(0x00000001),
        IO_DOWNSAMPLE(0x00000002),
        IO_CONVERTTOCMYK(0x00000004),
        IO_OUTPUTDOCXA(0x00000008),
        IO_XMPMETADATA(0x00000010),
        IO_OUTPUTDOCXA8(0x00000020),
        IO_NOPRECOMPRESSED(0x00000040),
        IO_OUTPUTDOCXX1(0x00000080),
        IO_OUTPUTDOCXX3(0x00000100),
        IO_COMPRESSJBIG2(0x00000200),
        IO_ENABLEEPS(0x40000000),
        IO_SIMPOSTSCRIPT(0x80000000);
        public int value;
        public acImageOptions(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),
        EmbedFonts(0x00000010),
        BroadcastMessages(0x00000020);
        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);
 
        // 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 Image conversion options in IO_CONVERTTOCMYK (Mandatory)
        Dispatch.put(docx,"ImageOptions", acImageOptions.IO_CONVERTTOCMYK.value);
 
        // Set the ColorProfile option locate in %WINDIR%\system32\spool\drivers\color
        Dispatch.put(docx, "SetColorProfile", "AmyuniCMYK");
 
        // Apply Settings
        Dispatch.call(docx, "SetDefaultConfig");
 
        // 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;        
    }
}
$acImageOptions = @{
    IO_NODUPLICATES = 0x00000001
    IO_DOWNSAMPLE = 0x00000002
    IO_CONVERTTOCMYK = 0x00000004
    IO_OUTPUTDOCXA = 0x00000008
    IO_XMPMETADATA = 0x00000010
    IO_OUTPUTDOCXA8 = 0x00000020
    IO_NOPRECOMPRESSED = 0x00000040
    IO_OUTPUTDOCXX1 = 0x00000080
    IO_OUTPUTDOCXX3 = 0x00000100
    IO_COMPRESSJBIG2 = 0x00000200 
    IO_ENABLEEPS = 0x40000000 
    IO_SIMPOSTSCRIPT = 0x80000000
} 
 
$acFileNameOptions = @{
    NoPrompt = 0x00000001
    UseFileName = 0x00000002
    EmbedFonts = 0x00000010
    BroadcastMessages = 0x00000020
} 
#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)
 
#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 Image conversion options in IO_CONVERTTOCMYK (Mandatory)
[System.__ComObject].InvokeMember('ImageOptions', [System.Reflection.BindingFlags]::SetProperty,$null,$DOCX,$acImageOptions::IO_CONVERTTOCMYK)
 
#Set the Postscript option locate in %WINDIR%\system32\spool\drivers\color
[System.__ComObject].InvokeMember('SetColorProfile', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,"AmyuniCMYK")
 
#Apply Settings
[System.__ComObject].InvokeMember('SetDefaultConfig', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, $null)
 
#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
' ImageOptions constants
Const IO_NODUPLICATES = &H1
Const IO_DOWNSAMPLE = &H2
Const IO_CONVERTTOCMYK = &H4
Const IO_OUTPUTDOCXA = &H8
Const IO_XMPMETADATA = &H10
Const IO_OUTPUTDOCXA8 = &H20
Const IO_NOPRECOMPRESSED = &H40
Const IO_OUTPUTDOCXX1 = &H80
Const IO_OUTPUTDOCXX3 = &H100
Const IO_COMPRESSJBIG2 = &H200
Const IO_ENABLEEPS = &H40000000
Const IO_SIMPOSTSCRIPT = &H80000000
 
' 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
 
' 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 Image conversion options in IO_CONVERTTOCMYK (Mandatory)
DOCX.ImageOptions = IO_CONVERTTOCMYK
 
' Set the ColorProfile option locate in %WINDIR%\system32\spool\drivers\color        
DOCX.SetColorProfile("AmyuniCMYK")
 
' Apply Settings
DOCX.SetDefaultConfig
 
' 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