HTML-to-RTF Pro DLL COM- methods and properties description

The component can convert HTML files(strings) into RTF or TXT files (strings) with images, tables, CSS etc.
This scheme shows all methods and properties of DLL, but you can use not all of members, because all of them is already set by default to make conversion more precise.

Methods:
 Convert()
 ConvertFile() *
 ConvertFileToString() *
 ConvertStringToFile()
 
Properties:

text parameters:
 OutputTextFormat
 Encoding
 RtfLanguage
 FontFace
 FontSize
 PageAlignment
 PreserveFontFace
 PreserveFontSize
 PreserveFontColor
 PreserveHyperlinks
 PreserveHR

table parameters:
 PreserveTables
 PreserveTableWidth
 PreserveNestedTables
 BorderVisibility

image parameters:
 PreserveImages *
 ImageCompatible *
 
page parameters:
 PageSize *
 PageOrientation *
 PageMarginLeft *
 PageMarginRight *
 PageMarginTop *
 PageMarginBottom *
 PreservePageBreaks *
 PageHeader *
 PageFooter *
 PageNumbers *
 PageNumbersAlignH *
 PageNumbersAlignV *
color parameters:
 PreserveFontColor
 PreserveBackgroundColor
   
   
   
   
   

* - marked members are available only in Pro version.

string RTF Convert( string HTML, string PageHeader, string PageFooter) - this method takes HTML string and returns RTF string.

Example:
Dim h As New HTML2RTF.Converter
strRet = h.Convert("<b>This test</b>", "", "")

! If you don't want that header/footer appears in produced RTF document, use empty strings "" as parameters in methods.

PageHeader - put text in RTF page header (150 symbols max)


Possible values: any string, 150 symbols max
Default value: ""
Example:
PageHeader = "Page Header Example"
Example:
PageHeader = "{\b Bold Page Header Example}"
Example:
PageHeader = "{\b\i Bold Italic Page Header Example}"
Example:
PageHeader = "{\qc Centered Page Header Example}"

h.Convert("<b>This test</b>", PageHeader, PageFooter)

PageFooter - put text in RTF page footer (150 symbols max)


Possible values: any string, 150 symbols max
Default value: ""
Example:
PageFooter = "Page Footer Example"

h.Convert("<b>This test</b>",
PageHeader, PageFooter)

int ConvertFile( string HTMLpath, string RTFpath, string PageHeader, string PageFooter ) - this method converts HTML file into RTF file. This method supports image conversion.

return values:

CONVERTING_SUCCESSFUL  - convert ok ( value 0 )
NOT_ENOUGH_MEMORY    - not enough memory ( value 1 )
RTF_CREATE_ERROR       - can't create RTF file ( value 2 )
HTML_OPEN_ERROR        - can't open HTML file ( value 3 )
HTML_HAS_ZERO_LENGTH   - the HTML file has zero length ( value 4)
UNKNOWN_ERROR         - unknown error ( value 5)

Example:
Dim h As New HTML2RTF.Converter
strRet = h.ConvertFile("D:\test.htm","d:\", "", "")
                   'or
strRet = h.ConvertFile("D:\test.htm","d:\file.rtf", "Sample header", "Sample footer")

string ConvertFileToString( string HTMLpath, string PageHeader, string PageFooter ) - this method takes HTML file and returns RTF string.

int ConvertStringToFile( string HTML, string RTFpath, string PageHeader, string PageFooter ) - this method takes HTML string and creates RTF file.
return values:

CONVERTING_SUCCESSFUL  - convert ok ( value 0 )
NOT_ENOUGH_MEMORY    - not enough memory ( value 1 )
RTF_CREATE_ERROR       - can't create RTF file ( value 2 )
HTML_OPEN_ERROR        - can't open HTML file ( value 3 )
HTML_HAS_ZERO_LENGTH   - the HTML file has zero length ( value 4)
UNKNOWN_ERROR         - unknown error ( value 5)


You may adjust the component and output RTF file will look as you wish. After creating object of HTML2RTF, you cant set the object properties:


BorderVisibility - this property set table border's visibility;
or
Possible values: Hidden, SameAsOriginalHtml, Visible.
Integer values:

Name
Integer equivalent
Visible
1
Hidden
0
SameAsOriginalHtml
2

Default value: Hidden
Example:
Dim h As New HTML2RTF.Converter
h.BorderVisibility = Visible
h.BorderVisibility = 1

Encoding - default encoding of HTML page
Possible values: AutoSelect, ISO_8859_1, ISO_8859_5, KOI8_R, Windows_1250, Windows_1251, Windows_1252, Windows_1253, Windows_1254, Windows_1255, Windows_1256, Windows_1257, Windows_1258.
Integer values:

Name
Integer equivalent
AutoSelect
0
ISO_8859_1
1
ISO_8859_5
2
KOI8_R
3
Windows_1251
4
UTF_8
5
Windows_1254
6
Windows_1256
7
Windows_1250
8
Windows_1252
9
Windows_1253
10
Windows_1255
11
Windows_1257
12
Windows_1258
13

Default value: AutoSelect
Example:
h.Encoding = ISO_8859_1
Example: h.Encoding = 1

OutputTextFormat - type of output file (RTF or TXT)
Possible values: Rtf, Text.
Integer values:

Name
Integer equivalent
Rtf
0
Text
1

Default value: Rtf
Example:
h.OutputTextFormat = Text
Example: h.OutputTextFormat = 1

FontFace - default font face
Possible values: f_Arial, f_Times_New_Roman, f_Verdana, f_Helvetica, f_Courier, f_Courier_New,
f_Times, f_Georgia, f_MS_Sans_Serif, f_Futura, f_Arial_Narrow, f_Garamond, f_Impact,
f_Lucida_Console, f_Tahoma, f_Inform, f_Symbol, f_WingDings, f_Traditional_Arabic
Integer values:

Name
Integer equivalent
f_Arial
0
f_Times_New_Roman
1
f_Verdana
2
f_Helvetica
3
f_Courier
4
f_Courier_New
5
f_Times
6
f_Georgia
7
f_MS_Sans_Serif
8
f_Futura
9
f_Arial_Narrow
10
f_Garamond
11
f_Impact
12
f_Lucida_Console
13
f_Tahoma
14
f_Inform
15
f_Symbol
16
f_WingDings
17
f_Traditional_Arabic
18

Default value: f_Arial
Example:
h.FontFace = HTML2RTF.f_Verdana
Example:
h.FontFace = 2

FontSize - default font size
Possible values: Any size
Default value: 10
Example:
h.FontSize = 12

PageAlignment - default page alignment
Possible values: AlignLeft, AlignRight, AlignCenter, AlignJustify.
Integer values:

Name
Integer equivalent
AlignLeft
0
AlignCenter
1
AlignRight
2
AlignJustify
3

Default value: AlignLeft
Example:
h.PageAlignment = HTML2RTF.AlignLeft
Example: h.PageAlignment = 0

PreserveAlignment - keep alignment as in HTML
or
Possible values: True or False
Default value: True

PreserveTables - convert tables or transform to text
or
Possible values: True or False
Default value: True

PreserveNestedTables - preserve nested tables as in HTML or transform it to plain tables
or
Possible values: True or False
Default value: False

PreserveImages - convert images or skip them (this feature work only in method ConvertFile)
or
Possible values: True or False
Default value: False

PreserveFontFace - keep font face as in HTML
or
Possible values: True or False
Default value: False

PreserveFontSize - keep font size as in HTML
or
Possible values: True or False
Default value: False

PreserveFontColor - keep font color as in HTML
or
Possible values: True or False
Default value: True

PreserveBackgroundColor - keep background color as in HTML (for table columns and text)

Possible values: True or False
Default value: True

PreserveHyperlinks - keep hyperlinks as in HTML
or
Possible values: True or False
Default value: False

PreserveTableWidth - keep width of table columns as in HTML
or
Possible values: True or False
Default value: False

PageSize - select page size for RTF

Possible values: A4, A3, A5, B5, Letter, Legal, Executive, Monarh
Default value: Letter
Integer values:

Name
Integer equivalent
A4
0
A3
1
A5
2
B5
3
Letter
4
Legal
5
Executive
6
Monarh
7

Example: h.PageSize = HTML2RTF.Legal
Example:
h.PageSize = 5

PageOrientation - select page orientation: Portrait or Landscape

Possible values: Portrait or Landscape
Default value: Portrait
Integer values:

Name
Integer equivalent
Portrait
0
Landscape
1

Example: h.PageOrientation = HTML2RTF.Landscape
Example:
h.PageOrientation = 1

PageMarginLeft, PageMarginRight, PageMarginTop, PageMarginBottom - set page margins

Possible values: margin_0mm, margin_5mm, margin_10mm, margin_15mm, margin_20mm,
margin_25mm, margin_30mm, margin_35mm, margin_40mm, margin_45mm, margin_50mm
Default values:
   PageMarginLeft      = margin_25mm
   PageMarginRight    = margin_10mm
   PageMarginTop      = margin_10mm
   PageMarginBottom = margin_10mm

Name
Integer equivalent
margin_0mm
0
margin_5mm
5
margin_10mm
10
margin_15mm
15
margin_20mm
20
margin_25mm
25
margin_30mm
30
margin_35mm
35
margin_40mm
40
margin_45mm
45
margin_50mm
50

RtfLanguage - language which will be used for spelling in Microsoft Word
Possible values: l_Albanian, l_English, l_Belgian, l_Bulgarian, l_Hungarian, l_Danish, l_Spanish,
l_Italian, l_Latvian, l_Lithuanian, l_German, l_Netherlands, l_Norwegian, l_Portuguese, l_Romanian, l_Russian,
l_Ukrainian, l_Finnish, l_French, l_Czech, l_Swedish, l_Turkish, l_Arabic.
Integer values:

Name
Integer equivalent
l_Albanian
1052
l_English
1033
l_Belgian
2067
l_Bulgarian
1026
l_Hungarian
1038
l_Danish
1030
l_Spanish
3082
l_Latvian
1062
l_Lithuanian
1063
l_German
1031
l_Netherlands
1043
l_Norwegian
2068
l_Portuguese
2070
l_Romanian
1048
l_Russian
1049
l_Ukrainian
1058
l_Finnish
1035
l_French
1036
l_Czech
1029
l_Swedish
1053
l_Arabic
1053
l_Turkish
1055
l_Japanese
932
l_SimplifiedChinese
936
l_TraditionalChinese
950
l_Korean
949
l_Thai
874

Default value: l_English
Example:
h.RtfLanguage = HTML2RTF.l_English
Example:
h.RtfLanguage = 1033

ImageCompatible - select image compatible: image_Word or image_WordPad

Possible values: image_Word or image_WordPad
Default value: image_Word
Integer values:

Name
Integer equivalent
image_Word
0
image_WordPad
1

When you selected image_Word the images will be strored in JPG, PNG and WMF formats:
{\pict...\pngblip....89504e470d0a1a0a000......}
{\pict...\jpegblip....ffd8ffe070d0a1a0a000......}
{\pict...\wmetafile8....010009000003de000......}

When you selected image_WordPad the images will be strored in BMP format:
{\pict...\dibitmap0....28000000690100......}

Example:
h.PageOrientation = HTML2RTF.image_WordPad
Example:
h.PageOrientation = 1

PreservePageBreaks - preserve page breaks as in HTML

If 'True', then converter will create new page in RTF each time when it meet 'page-break-before:' or 'page-break-aftrer:'.
Possible values: True or False
Default value: False
This is example for page-breaks:

<HTML>
<HEAD>
<TITLE>page-break-after</TITLE>
<STYLE>
P.after {page-break-after: always}
P.before {page-break-before: always}
</STYLE>
</HEAD>
<BODY>
<p class="before">Some text</p>
<p class="after">Some text</p>
<p>Some text</p>
</BODY>
</HTML>

 

PageNumbers - put page numbers

Possible values: PageNumDisable, PageNumFirst and PageNumSecond
Default value: PageNumDisable
Integer values:

Name
Integer equivalent
PageNumDisable
0
PageNumFirst
1
PageNumSecond
2

Example: h.PageNumbers = HTML2RTF.PageNumFirst

PageNumbersAlignH - horizontal alignment of page numbers
Possible values: AlignLeft, AlignRight, AlignCenter.
Integer values:

Name
Integer equivalent
AlignLeft
0
AlignCenter
1
AlignRight
2

Default value: AlignCenter
Example:
h.PageNumbersAlignH = HTML2RTF.AlignLeft
Example: h.PageNumbersAlignH = 0

PageNumbersAlignV - vertical alignment of page numbers
Possible values: AlignTop, AlignBottom
Integer values:

Name
Integer equivalent
AlignTop
4
AlignBottom
5

Default value: AlignBottom
Example:
h.PageNumbersAlignV = HTML2RTF.AlignLeft
Example: h.PageNumbersAlignV = 0

PreserveHR - keep horizontal rule <HR> as in HTML

Possible values: True or False
Default value: True