Converts HTML, XHTML, ASPX file/URL to RTF or Text file. Output file will be overwritten.
Namespace:
SautinSoftAssembly: SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 4.1.7.15
Syntax
| C# | Visual Basic |
Parameters
- htmlFile
- String
Path to local HTML file or URL
- outFolder
- String
Local path or folder to save output RTF or Text file
Return Value
0 - converting successfully1 - can't open input HTML file, check the input path
2 - can't create output file, check the output path
3 - converting failed
Examples
using System; using System.IO; using System.Text; namespace SampleConvert { class Class1 { static void Main(string[] args) { SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf(); //this property is necessary only for registered version //h.Serial = "XXXXXXXXXXXXX"; //specify some options h.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.Rtf; h.Encoding = SautinSoft.HtmlToRtf.eEncoding.AutoSelect; h.PageStyle.PageSize.Letter(); string htmlFile = @"..\..\..\..\..\Test.htm"; string rtfFile = @"..\..\..\..\..\Test.rtf"; int i = h.ConvertFile(htmlFile,rtfFile); if (i==0) { System.Console.WriteLine("Converted successfully!"); System.Diagnostics.Process.Start(rtfFile); } else System.Console.WriteLine("Converting Error!"); } } }
Imports System Imports System.IO Imports System.Text Module Module1 Sub Main() Dim h As New SautinSoft.HtmlToRtf 'this property is necessary only for registered version 'h.Serial = "XXXXXXXXXXXXX"; 'specify some options h.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.Rtf h.Encoding = SautinSoft.HtmlToRtf.eEncoding.AutoSelect h.PageStyle.PageSize.Letter() Dim htmlFile As String = "..\..\..\..\Test.htm" Dim rtfFile As String = "..\..\..\..\Test.rtf" Dim i As Integer = h.ConvertFile(htmlFile, rtfFile) If i = 0 Then System.Console.WriteLine("Converted successfully!") System.Diagnostics.Process.Start(rtfFile) Else System.Console.WriteLine("Converting Error!") End If End Sub End Module