Writing your own extension DLL

An extension DLL exports three public functions:

The function scGetJobInfo() is called to get the default print preferences, such as the form name, print quality etc. The function should return TRUE if it wants to do so, and update the relevant fields within the given SCJOBINFO structure. Otherwise, it should return FALSE. Note that this sets the default print settings, but the user or application can still override these settings via the "Print Preferences" dialog box.

The SCJOBINFO structure definition is shown below:

typedef struct _SCJOBINFO
    TCHAR formName[32];
    int printQuality;
    int colorType;
    int jpegQuality;
    int tiffCompression;
    int tiffQuality;
    int pdfQuality;
    int antialias;
Parameter Description
formName Form name. This could be the name of any valid form defined within Windows. Please refer to Defining custom forms to find out how to view the entire list of forms defined within your system.
printQuality Any value between 100 to 300 dpi.
jpegQuality Any value between 1 to 100. Higher value indicates better image quality, but larger file size.
tiffCompression One of SC_TIFTYPE_NONE, SC_TIFTYPE_PACKBITS, SC_TIFTYPE_CCITT_HUFFMAN, SC_TIFTYPE_CT_CCITT_T4, SC_TIFTYPE_CT_CCITT_T6 or SC_TIFTYPE_JPEG. Note that packbits or one of the other CCITT types are only applicable if colorType is set to SC_OUTPUT_BLACKWHITE.
tiffQuality Only applicable if tiffCompression is set to SC_TIFTYPE_JPEG. Only values between 1 to 100 are accepted. Higher value indicates better image quality, but larger file size.
pdfQuality Any value between 1 to 100. Higher value indicates better image quality, but larger file size.
antialias SC_ANTIALIAS_DISABLED or SC_ANTIALIAS_ENABLED. Only effective when printQuality is < 300 dpi.

The function scGetSaveFileName() is called when a print job starts. The output filename and image type should be returned in the given SCFILEINFO* structure, and the function should return TRUE if it is able to do so. Otherwise, it should return FALSE, in which case the print job will be canceled.

The SCFILEINFO structure definition is shown below:

typedef struct _SCFILEINFO
    wchar_t name[MAX_PATH];
    wchar_t ext[MAX_PATH];
    int type;
    WORD pageCount;
Parameter Description
name Output filename without the extension. This parameter is populated with the default filename (which is based on the name of the print job) initially. Replace with the desired filename if necessary. This parameter is required.
ext Extension of the output filename. This parameter is optional. If not supplied, the default extension will be used based on the image type supplied in type
type Output image type, which could be one of SC_BMP, SC_PNG, SC_JPG, SC_TIF_SINGLE, SC_PDF_SINGLE, SC_TIF_MULTIPLE, SC_PDF_MULTIPLE. This parameter is required.
pageCount Whether to append page count for single-page formats, which should either be false (0), or true (non-0). This parameter is optional. The default value is "true".

The SCFILEINFO structure as well as the output image type constants are defined in softcopy.h in the SoftCopy installation directory (default: C:\Program Files\SoftCopy).

A skeletal extension DLL looks like this:

#include <windows.h>
#include "softcopy.h"

// Return job characteristics.
    return FALSE;

// Return output filename and image type.
    lstrcpy(info->name, L"c:\\output\\test");
    info->type = SC_PDF_MULTIPLE;
    return TRUE;

// Display a message box when print job is completed.
void WINAPI scEndOfJob(SCFILEINFO* info)
    MessageBox(NULL, L"Printing done!", L"Alert",

This extension DLL is not very useful in the real world sense (since the output filename is always c:\output\test.pdf), but it does illustrate the workings of the extension DLL and the ease of writing one.

Sample extension DLLs are supplied with the default SoftCopy installation in the examples subdirectory. Code samples are provided for Visual C++ 6, Visual Basic 6, Delphi 7, Visual C# 2005 and Visual VB.NET 2005. The Visual C++ code sample is actually quite developed and can be deployed without further modifications if it fits your application requirement. The other code samples are simpler and serve more as starting points for further development.

Note that extension DLLs must be compiled with Unicode enabled. This is because the Windows print driver architecture uses Unicode internally for data interchange.