FileNameOptionsEx

The FileNameOptionsEx property defines a number of options used in the generation of the PDF Converter products.

 

Syntax

ActiveX:

System.Int32 FileNameOptionsEx

DLL:

int SetFileNameOptions(HANDLE hPrinter, int nOptions)

 

Parameters

FileNameOptionsEx

[in, out] Combination of options as defined below.

hPrinter

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

nOptions

Combination of options using the Addition or the OR operators as defined for each product below.

Option

Value (Hex)

Value* (Dec)

Description

NoPrompt

0x00000001

1

Prevents the display of the file name dialog box.

UseFileName

0x00000002

2

Use the file name set by SetDefaultFileName as the output file name.

Concatenate

0x00000004

4

Concatenate with existing file instead of overwriting. This is useful only if the NoPrompt option is set. (Legacy, same than AppendExisting)

DisableCompression

0x00000008

8

Disable deflate (zip) compression of the page’s content.

EmbedFonts

0x00000010

16

Enable partially embedding of Regular Fonts used in the source document.

BroadcastMessages

0x00000020

32

Send notification messages for document generation progress to all running application.

PrintWatermark

0x00000040

64

Watermarks are printed on all printed pages.

MultilingualSupport

0x00000080

128

Add supports for international character sets.

EncryptDocument

0x00000100

256

Encrypt resulting document.

FullEmbed

0x00000200

512

Embed all the complete character map from the fonts used in PDF.  In difference with Partially Embedding which only embed the characters used.

UseTcpIpServer

0x00000400

1024

Reserved.

SendByEmail

0x00000800

2048

Send the document by e-mail.

ConfirmOverwrite

0x00001000

4096

If the file exists, confirm before overwriting.

AppendExisting

0x00002000

8192

If the file exists, append to existing file. Similar to Concatenate.

AddDateTime

0x00003000

12288

the file exists, add date and time to file name.

AddIdNumber

0x00004000

16384

If the file exists, add ID number to file name.

LinearizeForWeb

0x00008000

32768

Activate web optimization (Linearization)of PDF document.

PostProcessing

0x00010000

65536

Post process file using specified application. The application’s full path should be in the registry.

QualityLevelLow  

  JpegLevelLow (deprecated)

0x00020000

131072

Low quality image compression of images. This is equivalent to level 3 in the user interface.

QualityLevelMedium  

  JpegLevelMedium (deprecated)

0x00040000

262144

Medium quality image compression of images; this is equivalent to level 7 in the user interface.

QualityLevelHigh  

  JpegLevelHigh (deprecated)

0x00060000

393216

High quality image compression of images; this is equivalent to level 9 in the user interface.

Colors2GrayScale

0x00080000

524288

Replaces all colors by an equivalent gray scale value.

ConvertHyperlinks

0x00100000

1048576

Convert text beginning with http or www to a hyperlink.

EmbedStandardFonts

0x00200000

2097152

Embed Standard Fonts such as Arial, Times, etc.

EmbedLicensedFonts

0x00400000

4194304

Embed Licensed fonts.

Color256Compression

0x00800000

8388608

Activate 256 color compression.

JPEG2000Compression

0x01000000

16777216

Use Jpeg2000 Compression.

This parameter only affects color images and that it cannot be used in combination with PDF-A.

SendToCreator

0x02000000

33554432

Send the PDF data directly to the Amyuni PDF Creator product instead of saving to disk.

ExportToHTML

0x04000000

67108864

Export document to HTML format.

ExportToRTF

0x08000000

134217728

Export document to RTF format.

ExportToJPEG

0x10000000

268435456

Export document to JPEG format.

CCITTCompression

0x20000000

536870912

Activate CCITT Fax Level 4 compression for B&W images.

EncryptDocument128

0x40000000

1073741824

Use 128 bits encryption compatible with Adobe Acrobat® 5.

EncryptDocument256

0x40000100

1073742080

Use 256 bits encryption compatible with Adobe Acrobat® 5.

This requires a special license.

AutoImageCompression

0x80000000

2147483648

Use automatic image compression, i.e. the best compression option for each image in a document.

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

 

Return Value

SetFileNameOptions returns 1 if successful, 0 otherwise. FileNameOptionsEx returns the current value for the property.

 

Remarks

The export to Excel and TIFF is configured differently from the RTF, HTML or JPeg exports. To export to Excel or TIFF, the developer should use the SetPrinterParam functions in addition to FileNameOptionsEx.

 

if the default setting in the  JPEGCompression is enabled.  It is not possible to generate No Compressed Image file programmatically just using FileNameOptionsEx property.

 

Neither, if the default setting in the  FontEmbedding is enabled.  It is not possible to generate No Embedding Fonts file programmatically just using FileNameOptionsEx property.

 

Same behavior occurs if the default setting in the Encryption  is enabled.  It is not possible to generate No Encrypted file programmatically just using FileNameOptionsEx property.

 

Amyuni PDF Converter distinguishes 3 types of fonts: Standard Fonts (fonts included and installed by default with OS), Licensed Fonts (commercial fonts which need license to be used) and Regular Fonts which are the rest of the fonts, in other words, they are not standard nor licensed.

 

The EmbedFonts flag only will add the characters used in the PDF by Regular Fonts (partially embedding).

 

The EmbedStandardFonts flag only will add the characters used in the PDF by the Standard Fonts (partially embedding).

 

The EmbedLicensedFonts flag only will add the characters used in the PDF by the Licensed Fonts (partially embedding).

 

The FullEmbed flag needs to be used in conjunction with the previous 3 flags to force saving the complete character maps.  It allows to modify the PDF without problem, but the PDF size will be bigger.

 

Ex:  FileNameOptionsEx |= EmbedFonts; // Partially Embedding from the Regular Fonts.

Ex:  FileNameOptionsEx |= EmbedFonts | FullEmbed; // Full Embedding from Regular Fonts.

 

Ex:  FileNameOptionsEx |= EmbedFonts | EmbedStandardFonts; // Partially Embedding from Regular and Standard Fonts.  Licensed Fonts are not included.

Ex:  FileNameOptionsEx |= EmbedFonts | FullEmbed; // Full Embedding from Regular and Standard Fonts.  Licensed Fonts are not included.

 

Ex:  FileNameOptionsEx |= EmbedFonts | EmbedStandardFonts | EmbedLicensedFonts; // Partially Embedding from All Fonts used in the PDF.

Ex:  FileNameOptionsEx |= EmbedFonts | EmbedStandardFonts | EmbedLicensedFonts | FullEmbed; // Full Embedding from All Fonts used in the PDF.

 

 

To set 256 color compression, use the Color256Compression flag and one of the 3 QualityLevel flags.

 

To set Jpeg compression, use only one of the 3 QualityLevel flags.  The  Color256Compression and Jpeg2000Compression flags should be off

 

To set JPeg2000 compression, we use the Jpeg2000Compression flag and one of the 3 QualityLevel flags.

 

If the QualityLevel flag is not set, then it will be used the default value, 7, for the quality level.

 

For additional values check FileNameOptions2 property.

 

 

Member of CDIntfEx.CDIntfEx.

 

Example

<Flags()>

Public Enum acFileNameOptions As Integer

    NoPrompt = &H1

    UseFileName = &H2

    Concatenate = &H4

    DisableCompression = &H8

    EmbedFonts = &H10

    BroadcastMessages = &H20

    PrintWatermark = &H40

    MultilingualSupport = &H80

    EncryptDocument = &H100

    FullEmbed = &H200

    UseTcpIpServer = &H400

    SendByEmail = &H800

    ConfirmOverwrite = &H1000

    AppendExisting = &H2000

    AddDateTime = &H3000

    AddIdNumber = &H4000

    LinearizeForWeb = &H8000

    PostProcessing = &H10000

    QualityLevelLow = &H20000

    QualityLevelMedium  = &H40000

    QualityLevelHigh  = &H60000

    Colors2GrayScale = &H80000

    ConvertHyperlinks = &H100000

    EmbedStandardFonts = &H200000

    EmbedLicensedFonts = &H400000

    Color256Compression = &H800000

    Jpeg2000Compression = &H1000000

    SendToCreator = &H2000000

    ExportToHTML = &H4000000

    ExportToRTF = &H8000000

    ExportToJPEG = &H10000000

    CCITTCompression = &H20000000

    EncryptDocument128 = &H40000000

    EncryptDocument256 = &H40000100

    AutoImageCompression = &H80000000

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 Or acFileNameOptions.Color256Compression

 

    ' 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()

End Sub

[Flags]

public enum acFileNameOptions

{

    NoPrompt = 0x00000001,

    UseFileName = 0x00000002,

    Concatenate = 0x00000004,

    DisableCompression = 0x00000008,

    EmbedFonts = 0x00000010,

    BroadcastMessages = 0x00000020,

    PrintWatermark = 0x00000040,

    MultilingualSupport = 0x00000080,

    EncryptDocument = 0x00000100,

    FullEmbed = 0x00000200,

    UseTcpIpServer = 0x00000400,

    SendByEmail = 0x00000800,

    ConfirmOverwrite = 0x00001000,

    AppendExisting = 0x00002000,

    AddDateTime = 0x00003000,

    AddIdNumber = 0x00004000,

    LinearizeForWeb = 0x00008000,

    PostProcessing = 0x00010000,

    QualityLevelLow = 0x00020000,

    QualityLevelMedium = 0x00040000,

    QualityLevelHigh  = 0x00060000,

    Colors2GrayScale = 0x00080000,

    ConvertHyperlinks = 0x00100000,

    EmbedStandardFonts = 0x00200000,

    EmbedLicensedFonts = 0x00400000,

    Color256Compression = 0x00800000,

    Jpeg2000Compression = 0x01000000,

    SendToCreator = 0x02000000,

    ExportToHTML = 0x04000000,

    ExportToRTF = 0x08000000,

    ExportToJPEG = 0x10000000,

    CCITTCompression = 0x20000000,

    EncryptDocument128 = 0x40000000,

    EncryptDocument256 = 0x40000100,

    AutoImageCompression = unchecked((int)0x80000000)

}

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 | acFileNameOptions.Color256Compression);

 

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

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

 

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

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

 

public class Sample {

    public enum acFileNameOptions

        {

            NoPrompt(0x00000001),

            UseFileName(0x00000002),

            Concatenate(0x00000004),

            DisableCompression(0x00000008),

            EmbedFonts(0x00000010),

            BroadcastMessages(0x00000020),

            PrintWatermark(0x00000040),

            MultilingualSupport(0x00000080),

            EncryptDocument(0x00000100),

            FullEmbed(0x00000200),

            UseTcpIpServer(0x00000400),

            SendByEmail(0x00000800),

            ConfirmOverwrite(0x00001000),

            AppendExisting(0x00002000),

            AddDateTime(0x00003000),

            AddIdNumber(0x00004000),

            LinearizeForWeb(0x00008000),

            PostProcessing(0x00010000),

            QualityLevelLow(0x00020000),

            QualityLevelMedium(0x00040000),

            QualityLevelHigh(0x00060000),

            Colors2GrayScale(0x00080000),

            ConvertHyperlinks(0x00100000),

            EmbedStandardFonts(0x00200000),

            EmbedLicensedFonts(0x00400000),

            Color256Compression(0x00800000),

            Jpeg2000Compression(0x01000000),

            SendToCreator(0x02000000),

            ExportToHTML(0x04000000),

            ExportToRTF(0x08000000),

            ExportToJPEG(0x10000000),

            CCITTCompression(0x20000000),

            EncryptDocument128(0x40000000),

            EncryptDocument256(0x40000100),

            AutoImageCompression(0x80000000);

            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 does not 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 | acFileNameOptions.Color256Compression.value);

 

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

    }

}

$acFileNameOptions = @{

    NoPrompt = 0x00000001

    UseFileName = 0x00000002

    Concatenate = 0x00000004

    DisableCompression = 0x00000008

    EmbedFonts = 0x00000010

    BroadcastMessages = 0x00000020

    PrintWatermark = 0x00000040

    MultilingualSupport = 0x00000080

    EncryptDocument = 0x00000100

    FullEmbed = 0x00000200

    UseTcpIpServer = 0x00000400

    SendByEmail = 0x00000800

    ConfirmOverwrite = 0x00001000

    AppendExisting = 0x00002000

    AddDateTime = 0x00003000

    AddIdNumber = 0x00004000

    LinearizeForWeb = 0x00008000

    PostProcessing = 0x00010000

    QualityLevelLow = 0x00020000

    QualityLevelMedium = 0x00040000

    QualityLevelHigh = 0x00060000

    Colors2GrayScale = 0x00080000

    ConvertHyperlinks = 0x00100000

    EmbedStandardFonts = 0x00200000

    EmbedLicensedFonts = 0x00400000

    Color256Compressio = 0x00800000

    Jpeg2000Compression = 0x01000000

    SendToCreator = 0x02000000

    ExportToHTML = 0x04000000

    ExportToRTF = 0x08000000

    ExportToJPEG = 0x10000000

    CCITTCompression = 0x20000000

    EncryptDocument128 = 0x40000000

    EncryptDocument256 = 0x40000100

    AutoImageCompression = 0x80000000

}

 

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

$AMYUNIPRINTERNAME = "Amyuni PDF Converter"

 

#Declare a new cdintfex object if it does not 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

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

 

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

 

#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,$PDF,$null) 

 

#Destroy PDF object

$PDF = $null

' FileNameOptions constants

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

Const UseTcpIpServer = &H400

Const SendByEmail = &H800

Const ConfirmOverwrite = &H1000

Const AppendExisting = &H2000

Const AddDateTime = &H3000

Const AddIdNumber = &H4000

Const LinearizeForWeb = &H8000

Const PostProcessing = &H10000

Const QualityLevelLow = &H20000

Const QualityLevelMedium = &H40000

Const QualityLevelHigh = &H60000

Const Colors2GrayScale = &H80000

Const ConvertHyperlinks = &H100000

Const EmbedStandardFonts = &H200000

Const EmbedLicensedFonts = &H400000

Const Color256Compression = &H800000

Const Jpeg2000Compression = &H1000000

Const SendToCreator = &H2000000

Const ExportToHTML = &H4000000

Const ExportToRTF = &H8000000

Const ExportToJPEG = &H10000000

Const CCITTCompression = &H20000000

Const EncryptDocument128 = &H40000000

Const EncryptDocument258 = &H40000100

Const AutoImageCompression = &H80000000

 

' 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 Or Color256Compression

 

' 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