| |
/* TO COMPILE THIS EXAMPLE:
- Create a new console - application
- add this file to the project files tree
- add MSVC_L_tiffTEXT.lib to the project files tree
- compile, run and watch to the console output */
#include <stdio.h>
#include "../../IMP_text2Tiff.h"
//This is an optional CallBack message handler
void __stdcall MessageHook(char * msg, int UserData)
{
printf(" --> %s\\n", msg);
}
unsigned Handle; //Handle to TiffText-Object
void main(void) {
//Show version of the TiffText - DLL
printf("tiffTEXT Visual C Demo\n");
printf("Version: V%s\\n", dcTiffTextVersion());
//Create a TiffText converter object
Handle = dcTiffTextCreate();
//Enable message hook (optional)
dcTiffTextSetMessageHook(Handle, &MessageHook , NULL);
//Select Font
dcTiffTextSetFont(Handle, "Arial", 12);
//Select codepage of input text file
dcTiffTextSetCodePage(Handle, ANSI_CHARSET);
//Select pagesize, resolution and margins of output image
dcTiffTextSetSize(Handle, 800, 1200);
dcTiffTextSetResolution(Handle, 96, 96);
dcTiffTextSetBorder(Handle, 10, 10, 10, 10, FALSE);
//Select filesearch - behaviour
dcTiffTextSetFlags(Handle, ttf_CreateDirectories | ttf_RecursiveDirectories);
//Now execute the conversion
int cnt = dcTiffTextConvert(Handle, "c:\\temp\\in.txt", "c:\\temp");
if (cnt == 0) {
//Show a error - message
printf("Fehler: \n");
printf(dcTiffTextGetLastError(Handle));
} else
printf("Ok: %d& files", cnt);
//Free the tifftext - object
dcTiffTextFree(Handle);
exit(0);
}
|
|