HTML Converter Base Tags

You are not limited to converting HTML from a URL, a local directory, or an HTML string. You can also combine all three if you convert using base tags. The following HTML illustrates. In this example the HTML is a string, while the base href and the image img tags are URLs. When converting the HTML string, the base tag also resolves the URLs to provide a complete document before converting to PDF.

<base href="" target="_blank">
<p>This is local HTML to my file system.</p>
<img src="images/myImage.gif" width="24" height="39" alt="Image">

You can also convert the base path programmatically, as the following example illustrates.

string filePath = "./myimage.jpg";
string tempHtml = "<html><body><img src=\"" + filePath + "\">" + "<img src=\"" + filePath + "\">" + "</body></html>";
Uri resolvePath = new Uri("http//mypath/");
Converter.Convert(tempHtml, "output.pdf", resolvePath);

Note that the example combines HTML obtained from a URL (the image file) with HTML from a local string. DynamicPDF HTML converter supports this mixed-conversion through the HTML base tag.

In this topic