We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem of body background binary image when converting html string to pdf


When I convert html string to pdf, binary image of body background is not added to document. Can you help me?

sample code:

using (var streamProvider = new MemoryStreamProvider())
using (var document = new Aspose.Html.HTMLDocument(statementHtml, “.”))
Aspose.Html.Converters.Converter.ConvertHTML(document, new Aspose.Html.Saving.PdfSaveOptions(), streamProvider);

            var memory = streamProvider.Streams.First();
            memory.Seek(0, System.IO.SeekOrigin.Begin);

            var arr = memory.ToArray();

            Response.Charset = "UTF-8";
            Response.AddHeader("content-length", arr.Length.ToString());
            Response.AddHeader("content-disposition", String.Format("attachment;filename=TestDocument.pdf", "FileName"));
            Response.ContentType = "application/pdf";
            Response.Buffer = true;


Could you please provide your sample HTML string to us? You can share it in a text file by adding it to .zip format. We will test the scenario in our environment and address it accordingly.

aspose.zip (291.0 KB)

I attached the zip file. Thank for reply.


We saved your file as .html and viewed it in different web browsers. We could not find the background image in it. Would you kindly share a screenshot of the rendered HTML with background image along with the browser information in which it is displaying. We will further proceed to assist you accordingly.

I see images when I create html file and write in code like this “Response.Write(statementHtml);”


We have logged an issue as HTMLNET-2831 in our issue management system for the sake of further investigation. We will look into ticket details and keep you informed about its resolution status. Please be patient and give us some time.

We are sorry for the inconvenience.

I wonder, is background image a general problem when converting html string to pdf?


We need to investigate the scenario in details in order to determine the reasons behind it. As soon as the investigation is done, we will be able to further comment over this problem. We will share updates with you for sure as soon as we have some after analysis. Please give us some time.

The issues you have found earlier (filed as HTMLNET-2831) have been fixed in this update. This message was posted using Bugs notification tool by pavel.petrushechkin