© 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

Methods and properties of the RTF-to-HTML DLL Win32

The component is created with Visual Studio 2005, it is absolutely standalone and doesn't require anything else. The size of component is about only 700 Kb, the average speed of converting is 4 files/per sec without images and 1 file/per sec with images.

The RTF-to-HTML DLL component has a lot of features, which help you to make output HTML as you wish.
This scheme demonstrates all properties and methods, but you may use only some of them, because all properties are already installed by default to make conversion as original.

Methods:
 ConvertFile()
 ConvertString()
 flushlist()
 ResetImageCounter()

Structure:
convertOptions
Structure parameters:
int htmlType
char title[120]
char extension[10]
char fontFace[50]
char fontSize[10]
int preserveImages
int preserveFontFace
int preserveFontSize
int preserveFontColor
int preserveHyperlinks
int tableBorders
int encoding
int htmlParts
char imageFolder[500]
char cssStyleName[120]
int fontSizesType
char imageSubfolder[120]
int hyperlinkTarget
int cssStartNumber

Methods

int ConvertFile(char *rtfFile, char *outFolder, struct convertOptions opt) - this method takes RTF (or Text) file and converts it into HTML file in the specified directory with specified options.

Return values:
-1 - unexpected error
0 - converting successful
1 - can't open input RTF
2 - can't create output HTML
3 - converting error
4 - can't open input file
5 - the input file has zerow length
6 - wrong serial

char * ConvertString(char * rtfBuf, char * htmlBuf, struct convertOptions opt) - this method takes RTF (or Text) string and returns HTML string with specified options. This function return string containing result html or empty string if error occur or serial number is wrong.

int flushlist () - call this function to release memory only after function ConvertString()

int ResetImageCounter() - reset counter for image names, for example image1.jpg, image2.jpg. After resetting count will strart from 1.

convertOptions - options of ouput HTML document.

int htmlType - type of ouput HTML file.

Possible values:
0-XHTML, 1- HTML, 2-HTML+CSS.

Default value: 1

Example: cOpt.htmlType = 2;

char title[120] - HTML page title, which appear between tags <title>...</title>

Possible values: Any string, maximum 120 symbols.

Example: strcpy(cOpt.title,"First page of site");

char extension[10] - extension for output HTML file.

Possible values: ".htm", ".html", ".asp" etc,

Default value: ".html"

Example: strcpy(cOpt.extension,".phtml");

char fontFace[50] - default font face.

Possible values: any font name.

Example: strcpy(cOpt.fontFace, "Verdana");

char fontSize[10] - default font size.

Example: strcpy(cOpt.fontSize, "12");

int preserveImages - if this parameter will be True then images will be preserved.

Possible values: 1, 0.

Example: cOpt.PreserveImages = 0;

int preserveFontFace - preserve font faces as in RTF.

Possible values: 1, 0.

Example: cOpt.PreserveFontFace = 0;

int preserveFontSize - preserve font sizes as in RTF.

Possible values: 1, 0.

Example: cOpt.PreserveFontSize = 0;

int preserveFontColor - preserve font colors as in RTF.

Possible values: 1, 0.

Example: cOpt.PreserveFontColor = 1;

int preserveHyperlinks - if this parameter will be True then images will be preserved.

Possible values: 1, 0.

Example: cOpt.PreserveHyperlinks = 0;

int tableBorders - visible/invisible table borders, True - visible.

Possible values: 1, 0.

Example: cOpt.tableBorders = 0;

int encoding - endcoding for HTML file.

Possible values: from 0 to 19.

Name = Integer equivalent
Windows-1250 = 0
Windows-1251 = 1
Windows-1252 = 2
Windows-1253 = 3
Windows-1254 = 4
Windows-1255 = 5
Windows-1256 = 6
Windows-1257 = 7
Windows-1258 = 8
ISO-8859-1 = 9
ISO-8859-2 = 10
ISO-8859-3 = 11
ISO-8859-4 = 12
ISO-8859-5 = 13
ISO-8859-6 = 14
ISO-8859-7 = 15
ISO-8859-8 = 16
ISO-8859-9 = 17
KOI8-R = 18
UTF-8 = 19

Example: cOpt.encoding = 19;

int htmlParts - select parts of HTML which need to produce.

Possible values: 0, 1.

Name = Integer equivalent
Html completely = 0
only HTML between <body>...</body> = 1

Example: cOpt.htmlParts = 1;

char imageFolder[500] - path where images will be stored, this folder must already exist.
Path must be absolute, it must begin from "C:\.." or "D:\" etc.

Possible values: real path

Example: strcpy(cOpt.imageFolder,"D:\documents\html\");

char cssStyleName[120] - CSS style name, for example if name is "ts" so styles in HTML will look as <span class="ts1">.

Possible values: any string, max 120 symbols

Example: strcpy(cOpt.cssStyleName,"textstyle");

int fontSizesType - CSS style name, for example if name is "ts" so styles in HTML will look as <span class="ts1">.

Possible values: 0,1,2,3
0-normal sizes, 1 - medium sizes, 2 - big sizes, 3 - huge sizes

Example: cOpt.fontSizeType = 1;

char imageSubfolder[120] - folder which will be created by DLL to store images.

Must be without any "C:\.." or "D:\" etc, only folder as "my folder".
Possible values: "string", etc.

Example: strcpy(cOpt.imageSubFolder,"images");

int hyperlinkTarget - 0 - no target, 1 - target="_blank", 2 - _self, 3 - _parent, 4 - _top.

Possible values: 0,1,2,3,4

Example: cOpt.hyperlinkTarget = 1;

int cssStartNumber - number for style name, like a .tsN (.ts1 or .ts100).

Possible values: any positive value more than 0

Example: cOpt.cssStartNumber = 10; //so the firts style will have a name "ts10"

See examples of using DLL

 

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