Free Support Forum -

HTML to PDF - Images do not render


I am using the following code to convert from HTML to PDF. Although the PDF is created, no images are rendered. I have tried just about every possible combination of the baseUri and actual image address, but to no avail. The page detailing the conversion to PDF mechanism (HTML to PDF Conversion) does not include examples with images. Nor does it demonstrate the use of the basrUri property (which I’m assuming is what I need to specify)

public Stream Convert(string html, int height, int width, string baseUrl = "")
		var options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions
			PageSetup =
				AnyPage = new Page(new Size(height, width)),
				AdjustToWidestPage = true

		var output = new MemoryStream();

		using (var stream = new MemoryStream())
		using (var writer = new StreamWriter(stream))
			stream.Position = 0;
			using (var device = new Aspose.Html.Rendering.Pdf.PdfDevice(options, output))
			using (var renderer = new HtmlRenderer())
			using (var document = new HTMLDocument(stream, baseUrl))
				renderer.Render(device, document);

			output.Position = 0;
			return output;
	catch (Exception ex)
		throw new ApplicationException("Error converting to PDF!", ex);



Thank you for contacting support.

Would you please share source and generated ZIP files with us so that we may try to reproduce and investigate it in our environment.


Thanks for the response.

I have attached a solution file containing a class that performs the conversion and a small test application that generates some very simple HTML and calls the conversion to PDF.

I have included a result PDF file, where you can see the issue (the alt attribute value is rendered, but the image itself is not).

Thank you in advance for taking a look. (296.3 KB)



Thank you for sharing requested data.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID HTMLNET-1810 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.