© Copyright SautinSoft 2002 - 2009
(3.0.0 - February 16th, 2009)


Manual for RTF-to-HTML DLL Win32
- component to convert Text, RTF strings (files) to HTML, XHTML strings (files).
 about | methods and properties | code samples | rtf samples | faq | order and pricing | license | support and contacts

Code samples

Visual Studio 2005
Delphi
Java
 
Visual Studio 2005

HINSTANCE hMod=LoadLibrary("Sautinsoft.RTFToHTML.Win32.dll");
printf("Please enter rtf file (example: d:\\my.rtf):\n");
gets(rtffile);
printf("Please enter output folder (example : d:\\temp):\n");
gets(outfolder);
struct convertOptions ct;
ct.cssStartNumber=1;
strcpy(ct.cssStyleName,"ts");
ct.encoding=9;
strcpy(ct.extension,".htm");
strcpy(ct.fontFace,"Verdana");
strcpy(ct.fontSize,"10");
ct.htmlType=1;
ct.preserveFontColor=1;
ct.preserveFontFace=1;
ct.preserveFontSize=1;
ct.preserveImages=1;
ct.preserveHyperlinks=1;
ct.tableBorders=1;
ct.htmlParts=0; //only between <body>...</body>
strcpy(ct.title,"My Page");
strcpy(ct.imageFolder,"D:\\");
strcpy(ct.imageSubfolder,"test.files");
ct.hyperlinkTarget=0;
strcpy(ct.Serial,"Serial number");
ret=ConvertFile(rtffile,outfolder,ct);
switch(ret)
{
case -1 : puts("Unexpected error");break;
case 0 : puts("Conversion completed");break;
case 2 : puts("Not enough memory"); break;
case 3 : puts("Can't open output file"); break;
case 4 : puts("Can't open input file"); break;
case 5 : puts("The input file has zerow length"); break;
case 6: puts("Please check serial number"); break;
default: break;
}

getchar();
FreeLibrary((HMODULE)hMod);

Delphi

LoadLibrary('Sautinsoft.RTFToHTML.dll');
FConvertOptions.cssStartNumber:=1;
FConvertOptions.cssStyleName:='ts';
FConvertOptions.encoding:=6;
FConvertOptions.extension:='.htm';
FConvertOptions.fontFace:='Verdana';
FConvertOptions.fontSize:='10';
FConvertOptions.htmlType:=1;
FConvertOptions.preserveFontColor:=1;
FConvertOptions.preserveFontFace:=1;
FConvertOptions.preserveFontSize:=1;
FConvertOptions.preserveImages:=1;
FConvertOptions.preserveHyperlinks:=1;
FConvertOptions.tableBorders:=1;
FConvertOptions.htmlParts:=0; //only between <body>...</body>
FConvertOptions.title:='My Page';
FConvertOptions.imageFolder:='D:\\';
FConvertOptions.imageSubfolder:='test.files';
FConvertOptions.hyperlinkTarget:=0;
FConvertOptions.Serial:='Serial number';
convert_code:=ConvertFile(pchar(RtfName.Text), pchar(HtmlName.Text);
case convert_code of
-1: result.Caption:='Unexpected error';
0: result.Caption:='Converting OK';
2: result.Caption:='Not enough memory';
3: result.Caption:='Can''t create HTML file';
4: result.Caption:='Can''t open RTF file';
5 : result.Caption:='The input file has zerow length';
6 : result.Caption:='Please check serial number';

Java

For using RtfToHtml in java you must use wrapper (included). Then you must make dll which will be added in Java code:
public native int ConvertFile(String inFile,String outFile, String Serial);
public native String CovertString(String inFile, String Serial);
static
{
try
{
System.load("path to SautinSoft.RtfToHtml.Win32.Java.dll");
}
catch(Exception exc)
{
System.out.println(exc.toString());
}
}
try
{
Main ex = new Main();
int ret = ex.ConvertFile("d:\\1.rtf", "d:\\", "serial number");
switch(ret)
{
case -1: System.out.println("Unexpected error"); break;
case 0: System.out.println("Converting OK"); break;
case 2: System.out.println("Not enough memory"); break;
case 3: System.out.println("Can't create HTML file"); break;
case 4: System.out.println("Can't open RTF file"); break;
case 5: System.out.println("The input file has zerow length"); break;
case 6: System.out.println("Please check serial number"); break;
}
}
catch(Exception exc)
{
System.out.println(exc.toString());
}


Copyright © 2002-2009, SautinSoft. All rights reserved.