public void OpenFromStreamWithBaseUri()
{
//ExStart
//ExFor:Document.#ctor(Stream,LoadOptions)
//ExFor:LoadOptions
//ExFor:LoadOptions.BaseUri
//ExId:DocumentCtor_LoadOptions
//ExSummary:Opens an HTML document with images from a stream using a base URI.
// We are opening this HTML file:
// <html>
// <body>
// <p>Simple file.</p>
// <p><img src="Aspose.Words.gif" width="80" height="60"></p>
// </body>
// </html>
string fileName = MyDir + "Document.OpenFromStreamWithBaseUri.html";
// Open the stream.
Stream stream = File.OpenRead(fileName);
// Open the document. Note the Document constructor detects HTML format automatically.
// Pass the URI of the base folder so any images with relative URIs in the HTML document can be found.
LoadOptions loadOptions = new LoadOptions();
loadOptions.BaseUri = MyDir;
Document doc = new Document(stream, loadOptions);
// You can close the stream now, it is no longer needed because the document is in memory.
stream.Close();
// Save in the DOC format.
doc.Save(MyDir + @"\Artifacts\Document.OpenFromStreamWithBaseUri.doc");
//ExEnd
// Lets make sure the image was imported successfully into a Shape node.
// Get the first shape node in the document.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
// Verify some properties of the image.
Assert.IsTrue(shape.IsImage);
Assert.IsNotNull(shape.ImageData.ImageBytes);
Assert.AreEqual(80.0, ConvertUtil.PointToPixel(shape.Width));
Assert.AreEqual(60.0, ConvertUtil.PointToPixel(shape.Height));
}