HtmlToRtfHtmlConvertOptionsBaseURL Property |
It's target path of the HTML document base location.
Namespace: SautinSoftAssembly: SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 2024.12.12
Syntax public string BaseURL { get; set; }
Public Property BaseURL As String
Get
Set
Property Value
StringRemarks This is very important property when you are converting HTML document in memory. Specify a BaseURL that is it will convert all relative URLs on that page to absolute URLs.
For example, lets convert HTML string to RTF file.
If we've specified:
HtmlConvertOptions opt = new HtmlConvertOptions();
opt.BaseURL = @"d:\my webs";
When the component meets 'src="images/asterisk.jpg"' it will try to open it from: "d:\my webs\images\asterisk.jpg"
Example Convert HTML url to RTF file using C#
using System;
using System.IO;
using SautinSoft;
using static SautinSoft.HtmlToRtf;
namespace Sample
{
class Test
{
static void Main(string[] args)
{
ConvertHtmlUrlToRtfFile();
}
public static void ConvertHtmlUrlToRtfFile()
{
SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
string inpFile = @"https://www.sautinsoft.com/samples/Sample.html";
string outFile = "Result.rtf";
HtmlConvertOptions opt = new HtmlConvertOptions();
opt.BaseURL = @"https://www.sautinsoft.com/samples/";
if (h.Convert(inpFile, outFile, opt))
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
}
}
}
Convert HTML url to RTF file using VB.Net
Imports System
Imports System.IO
Imports SautinSoft
Imports SautinSoft.HtmlToRtf
Namespace Sample
Friend Class Test
Shared Sub Main(ByVal args() As String)
ConvertHtmlUrlToRtfFile()
End Sub
Public Shared Sub ConvertHtmlUrlToRtfFile()
Dim h As New SautinSoft.HtmlToRtf()
Dim inpFile As String = "https://www.sautinsoft.com/samples/Sample.html"
Dim outFile As String = "Result.rtf"
Dim opt As New HtmlConvertOptions()
opt.BaseURL = "https://www.sautinsoft.com/samples/"
If h.Convert(inpFile, outFile, opt) Then
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
End If
End Sub
End Class
End Namespace
See Also