LoadOptions.BaseUri
LoadOptions BaseUri property. Gets or sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null or empty string. Default is null.
LoadOptions.BaseUri property
Gets or sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null
or empty string. Default is null
.
public string BaseUri { get; set; }
Remarks
This property is used to resolve relative URIs into absolute in the following cases:
- When loading an HTML document from a stream and the document contains images with relative URIs and does not have a base URI specified in the BASE HTML element.
- When saving a document to PDF and other formats, to retrieve images linked using relative URIs so the images can be saved into the output document.
Examples
Shows how to specify base Uri in the document load options.
const string html = @"
<html>
<body>
<img src='logo.png'>
</body>
</html>";
MemoryStream htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html));
LoadOptions loadOptions = new LoadOptions();
loadOptions.BaseUri = ImageDir;
Converter.Create()
.From(htmlStream, loadOptions)
.To(ArtifactsDir + "LoadOptions.BaseUri.docx")
.Execute();
See Also
- class LoadOptions
- namespace Wordize.Loading
- assembly Wordize