ImageOptions

The ImageOptions property is used to set or read additional image conversion options.

 

Syntax

ActiveX:

System.Int32 ImageOptions

DLL:

long GetImageOptions(HANDLE hIntf)
void SetImageOptions(HANDLE hIntf, long nNewValue)

 

Parameters

ImageOptions, nNewValue

[in, out] Additional options for image conversion.

 

Options

Description

Value (Hex)

Value (Dec)*

IO_NODUPLICATES

Remove Duplicate Images.

0x0000001

1

IO_DOWNSAMPLE

Downsample high-resolution images.

0x0000002

2

IO_CONVERTTOCMYK

Convert RGB colors to CMYK.

0x0000004

4

IO_OUTPUTPDFA

Create PDF/A.

0x0000008

8

IO_XMPMETADATA

Add XMP metadata to PDF files (can be used independently of PDF/A).

0x0000010

16

IO_OUTPUTPDFA8

(Deprecated).

0x0000020

32

IO_NOPRECOMPRESSED

GDI to send uncompressed images instead of PNG/JPEG images.

0x0000040

64

IO_OUTPUTPDFX1

Create PDF files that conform to the PDF/X1 standard.

0x0000080

128

IO_OUTPUTPDFX3

Create PDF files that conform to the PDF/X3 standard.

0x00000100

256

IO_COMPRESSJBIG2  

Activates JBIG2 compression of black and white images.

0x00000200

512

IO_DISABLE_GENERATE_IMAGE_CLIPPINGS

Disable generate clipping for image when the image is coming as part of a transparency group

0x00004000

16384

IO_ENABLEEPS

Process EPS blocks.

0x40000000

1073741824

IO_SIMPOSTSCRIPT

Simulate postscript.

0x80000000

2147483648

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

 

hIntf

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

 

The options can be combined using the Addition or the OR operators.

 

Return Value

ImageOptions and GetImageOptions return the current value for the property.

 

Remarks

The call requires be followed by a call to SetDefaultConfig or SetDefaultConfigEx for these settings to take effect.

 

If the default setting in the SimPostscript is enabled.  It is not possible to generate No Postscript file programmatically just using ImageOptions property.

 

Member of CDIntfEx.CDIntfEx.

 

Example

<Flags()>

Public Enum acImageOptions As Integer

    IO_NODUPLICATES = &H1

    IO_DOWNSAMPLE = &H2

    IO_CONVERTTOCMYK = &H4

    IO_OUTPUTPDFA = &H8

    IO_XMPMETADATA = &H10

    IO_OUTPUTPDFA8 = &H20

    IO_NOPRECOMPRESSED = &H40

    IO_OUTPUTPDFX1 = &H80

    IO_OUTPUTPDFX3 = &H100

    IO_COMPRESSJBIG2 = &H200

    IO_DISABLE_GENERATE_IMAGE_CLIPPINGS = &H4000

    IO_ENABLEEPS = &H40000000

    IO_SIMPOSTSCRIPT = &H80000000

End Enum

 

<Flags()>

Public Enum QualityLevel As Integer

    LOW = 3

    GOOD = 7

    HIGH = 9

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

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

 

    ' Set Image conversion options

    PDF.ImageOptions = acImageOptions.IO_DOWNSAMPLE Or acImageOptions.IO_NODUPLICATES

 

    ' Set JPeg compression

    PDF.JPEGCompression = True

 

    ' Set QualityLevel for 24bits images.

    PDF.QualityLevel = QualityLevel.LOW

 

    ' 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

    PDF = Nothing    

End Sub

[Flags]

public enum acImageOptions

{

    IO_NODUPLICATES = 0x00000001,

    IO_DOWNSAMPLE = 0x00000002,

    IO_CONVERTTOCMYK = 0x00000004,

    IO_OUTPUTPDFA = 0x00000008,

    IO_XMPMETADATA = 0x00000010,

    IO_OUTPUTPDFA8 = 0x00000020,

    IO_NOPRECOMPRESSED = 0x00000040,

    IO_OUTPUTPDFX1 = 0x00000080,

    IO_OUTPUTPDFX3 = 0x00000100,

    IO_COMPRESSJBIG2 = 0x00000200,

    IO_DISABLE_GENERATE_IMAGE_CLIPPINGS = 0x0004000,

    IO_ENABLEEPS = 0x40000000,

    IO_SIMPOSTSCRIPT = unchecked((int)0x80000000)

}

[Flags]

public enum QualityLevel

{

    LOW = 3,

    GOOD = 7,

    HIGH = 9

}

[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

}

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;

 

    // Set Image conversion options

    PDF.ImageOptions = (int)(acImageOptions.IO_DOWNSAMPLE | acImageOptions.IO_NODUPLICATES);

 

    // Set JPeg compression

    PDF.JPEGCompression = true;

 

    // Set QualityLevel for 24bits images.

    PDF.QualityLevel = (int)QualityLevel.LOW;

 

    // 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 QualityLevel

{

    LOW = 3,

    GOOD = 7,

    HIGH = 9

};

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);

 

    // Set Image conversion options

    SetImageOptions(PDF, IO_DOWNSAMPLE | IO_NODUPLICATES);

 

    // Set JPeg compression

    SetJPEGCompression(PDF, true);

 

    // Set QualityLevel for 24bits images

    SetQualityLevel(PDF, QualityLevel::LOW);

 

    // Apply Settings

    SetDefaultConfig(PDF);

 

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

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

 

public class ImageOptions {

    public enum acImageOptions

    {

        // Please check FileNameOptions for the complete flags version

        IO_NODUPLICATES( 0x00000001),

        IO_DOWNSAMPLE( 0x00000002),

        IO_CONVERTTOCMYK( 0x00000004),

        IO_OUTPUTPDFA( 0x00000008),

        IO_XMPMETADATA( 0x00000010),

        IO_OUTPUTPDFA8( 0x00000020),

        IO_NOPRECOMPRESSED( 0x00000040),

        IO_OUTPUTPDFX1( 0x00000080),

        IO_OUTPUTPDFX3( 0x00000100),

        IO_COMPRESSJBIG2( 0x00000200),  // It cannot be used with PDF/A standard

        IO_ENABLEEPS( 0x40000000),

        IO_DISABLE_GENERATE_IMAGE_CLIPPINGS( 0x0004000),

        IO_SIMPOSTSCRIPT( 0x80000000);

        public int value;

        public acImageOptions(int value)

        {

            this.value = value;

        }

        public Object value(){

            return value;

        }        }

 

    public enum JPEG_LEVEL

    {

        // Please check FileNameOptions for the complete flags version

        LOW(3),

        GOOD(7),

        HIGH(9);

        public int value;

        public JPEG_LEVEL(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);

            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 doesn' t 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);

 

        // Set Image conversion options

        Dispatch.put(pdf,"ImageOptions", acImageOptions.IO_DOWNSAMPLE.value |  acImageOptions.IO_DOWNSAMPLE.value);

 

        // Set JPeg compression

        Dispatch.put(pdf,"JPEGCompression", true);  // For 7mm

 

        // Set QualityLevel fpr 24bits images

        Dispatch.put(pdf,"QualityLevel", JPEG_LEVEL.LOW.value);  // For 7mm

 

        // Apply Settings

        Dispatch.call(pdf, "SetDefaultConfig");

 

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

    }

}

$acImageOptions = @{

    IO_NODUPLICATES = 0x00000001

    IO_DOWNSAMPLE = 0x00000002

    IO_CONVERTTOCMYK = 0x00000004

    IO_OUTPUTPDFA = 0x00000008

    IO_XMPMETADATA = 0x00000010

    IO_OUTPUTPDFA8 = 0x00000020

    IO_NOPRECOMPRESSED = 0x00000040

    IO_OUTPUTPDFX1 = 0x00000080

    IO_OUTPUTPDFX3 = 0x00000100

    IO_COMPRESSJBIG2 = 0x00000200  # It cannot be used with PDF/A standard

    IO_DISABLE_GENERATE_IMAGE_CLIPPINGS = 0x0004000

    IO_ENABLEEPS = 0x40000000 

    IO_SIMPOSTSCRIPT = 0x80000000

 

$JPEG_LEVEL = @{

    LOW = 3

    GOOD = 7

    HIGH = 9

 

$acFileNameOptions = @{

    NoPrompt = 0x00000001

    UseFileName = 0x00000002

    Concatenate = 0x00000004

    DisableCompression = 0x00000008

    EmbedFonts = 0x00000010

    BroadcastMessages = 0x00000020

    PrintWatermark = 0x00000040

#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 doesn' t 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 (1)

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

 

#Set Image conversion options

[System.__ComObject].InvokeMember('ImageOptions', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acImageOptions::IO_DOWNSAMPLE -bOr $acImageOptions::IO_NODUPLICATES)

 

#Set JPeg compression

[System.__ComObject].InvokeMember('JPEGCompression', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$True)

 

#Set QualityLevel fpr 24bits images

[System.__ComObject].InvokeMember('QualityLevel', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$JPEG_LEVEL::LOW)

 

#Apply Settings

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

 

#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) 

 

#Close Printer

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

 

#Destroy PDF object

$PDF = $null

' ImageOptions constants

Const IO_NODUPLICATES = &H1

Const IO_DOWNSAMPLE = &H2

Const IO_CONVERTTOCMYK = &H4

Const IO_OUTPUTPDFA = &H8

Const IO_XMPMETADATA = &H10

Const IO_OUTPUTPDFA8 = &H20

Const IO_NOPRECOMPRESSED = &H40

Const IO_OUTPUTPDFX1 = &H80

Const IO_OUTPUTPDFX3 = &H100

Const IO_COMPRESSJBIG2 = &H200

Const IO_DISABLE_GENERATE_IMAGE_CLIPPINGS = &H0004000

Const IO_ENABLEEPS = &H40000000

Const IO_SIMPOSTSCRIPT = &H80000000

 

' QualityLevel constants

Const LOW = 3

Const GOOD = 7

Const HIGH = 9

 

' 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 FullEmbed = &H200

 

' 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

 

' Set Image conversion options

PDF.ImageOptions = IO_DOWNSAMPLE Or IO_NODUPLICATES

 

' Set JPeg compression

PDF.JPEGCompression = True

 

' Set QualityLevel for 24bits images.

PDF.QualityLevel = LOW

 

' 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