Here is a code sample demonstrating how to use the exported DLL functions in C++:
#define SC_PDF 0 //Create a normal editable file using 1.7 standard.
#define SC_PDF_A 2 //Create a PDF/A-2B write protected file for archiving.
//scConverter.dll exported functions
typedef int ( *SC_SET_PDFSTANDARD)( long Format );
typedef int ( *SC_SET_PDFLARGEFORMAT)( long Enable );
typedef int ( *SC_SET_PDFLAYERS)( long Enable );
typedef int ( *SC_SET_TIFFSINGLESTRIP)( long Enable );
typedef int ( *SC_SET_IMPORTERPATH)( WCHAR *Path);
typedef int ( *SC_CONVERT_FILE)( WCHAR *pSerialNumber, WCHAR *pInputFile, WCHAR *pOutputFile,
WCHAR *pFormat, double dScale, long lBitsPerPixel, long lDPI );
int ConvertFile( WCHAR *InputFile, WCHAR *OutputFile, WCHAR Format, long BitsPerPixel, long DPI)
{
int result = 0;
HINSTANCE hLib = LoadLibraryExW( L"scConverter.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
if (!hLib) return -1;
//Get function pointers
SC_CONVERT_FILE ConvertFileFunc = (SC_CONVERT_FILE)GetProcAddress( hLib, "scConvertFile" );
SC_SET_PDFSTANDARD SetPDFStandardFunc = (SC_SET_PDFSTANDARD)GetProcAddress( hLib, "scSetPDFWriteFormat" );
SC_SET_PDFLARGEFORMAT SetPDFLargeFormatFunc = (SC_SET_PDFLARGEFORMAT)GetProcAddress( hLib, "scSetPDFLargeFormat" );
SC_SET_PDFLAYERS SetPDFLayersFunc = (SC_SET_PDFLAYERS)GetProcAddress( hLib, "scSetPDFLayers" );
SC_SET_TIFFSINGLESTRIP SetTIFFSingleStripFunc= (SC_SET_TIFFSINGLESTRIP)GetProcAddress( hLib, "scSetTIFFSingleStrip" );
SC_SET_IMPORTERPATH SetImporterPathFunc = (SC_SET_IMPORTERPATH)GetProcAddress( hLib, "scImportersPath" );
//Setup and do the conversion
SetPDFStandardFunc( SC_PDF_A );
SetPDFLayersFunc( 1 );
SetTIFFSingleStripFunc( 1 );
SetPDFLargeFormatFunc( 1 );
//Replace first paremeter _T("") with your serial number
result = ConvertFileFunc( _T(""), InputFile, OutputFile, Format, 1.0, BitsPerPixel, DPI );
FreeLibrary( hLib );
return result;
}
Sample usage of this function:
//create PDF
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.pdf", L"PDF", 1.0, 0, 0 );
//create monochrome TIFF, 300 dots per inch
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.tif", L"TIFF", 1.0, 1, 300 );
//create true color TIFF, 200 dots per inch
ConvertFile( L"c:\\temp\\test.plt", L"c:\\temp\test.tif") L"TIFF", 1.0, 24, 200 );