HTML to PDF conversion - error "Value cannot be null.\r\nParameter name: rawHtml"

someone please suggest me how to convert HTML file to PDF, where my HTML file is from share point document library and saving it back to document library again after conversion.

SPFile file = XXX_List.Items.Cast()
.Where(x => x.Name.Equals(filename_htm))
.Select(x => x.File)
.First();
System.IO.Stream data = file.OpenBinaryStream();
System.IO.MemoryStream mstream = new System.IO.MemoryStream();

                data.CopyTo(mstream);

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
Document pdfDoc = new Document(mstream, htmlLoadOptions);
pdfDoc.Save(file.ParentFolder + foldername + “.pdf”);

Im getting the below error:

Value cannot be null.\r\nParameter name: rawHtml

@Vimal89v

Thank you for contacting support.

Would you please share your source HTML document as a zipped file so that we may try to reproduce and investigate it in our environment.

Please find the source HTML attached as requested. I am facing issue in passing the HTML stream while converting into PDF.

Please check and guide me in resolving thsource HTML.zip (2.9 KB)
e issue.

@Vimal89v

We are unable to reproduce the issue with the file shared by you while using Aspose.PDF for .NET 18.12. Generated PDF file has been attached for your kind reference HTMLtoPDF_18.12.pdf. Would you please share a narrowed down sample application with us so that we may investigate further to help you out.

I’m using version 9.0. Is it possible to handle the fix in that version.

@Vimal89v

Please note that support is provided based on latest available version and the bug fixes or enhancements are incorporated in latest versions. You are using quite outdated version of the API so we would recommend updating to latest version which is more enhanced and improved.