No image showing up when converting html to pdf

Hi, We are generating some html and then converting to pdf. That works fine. We are trying to convert an image that is also in html and are not able to do it with a relative path. We would like to use a relative path instead of hardcoding it for different environments.
The html that contains the image looks like this:
<img src="/Styles/images/ctlLogo.png" />
This is the method to convert html to pdf:
Note: this line we can get the image to show up, but none of the others: pdf.HtmlInfo.ImgUrl = “C:/Projects/devACM/ACM.Web/Styles/images/”;

public byte[] ConvertHTMLtoPDF(string htmlToConvert)
{
//set Aspose license
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(“Aspose.Total.lic”);
//license.Embedded = true;
        // Instantiate a pdf object by calling its empty constructor
        Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
        //Create a section in the pdf document
        Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();
        //Create text paragraphs containing HTML text
        Aspose.Pdf.Generator.Text txt = new Aspose.Pdf.Generator.Text(htmlToConvert);
        txt.IsHtmlTagSupported = true;
        //Add the text paragraphs containing HTML text to the section
        sec1.Paragraphs.Add(txt);
        //pdf.HtmlInfo.ImgUrl = "~/";
        //pdf.HtmlInfo.ImgUrl = "~";
        //pdf.HtmlInfo.ImgUrl = "C:/Projects/devACM/ACM.Web/Styles/images/";
        //string path = Environment.CurrentDirectory;
        //string newPath = Path.GetFullPath(Path.Combine(path, @"..\..\..\"));
        //pdf.HtmlInfo.ImgUrl = newPath;
        pdf.HtmlInfo.ImgUrl = "~/Styles/images/";
        // specify the Character encoding for for HTML file
        //pdf.HtmlInfo.CharSet = "UTF-8";
        //pdf.HtmlInfo.CharsetApplyingLevelOfForce = Aspose.Pdf.Generator.HtmlInfo.CharsetApplyingForceLevel.UseWhenImpossibleDetectFromContent;
        // bind the source HTML
        //pdf.BindHTML(htmlToConvert);
        // Create a new memory stream. 
        MemoryStream outStream = new MemoryStream();
        // Save resultant PDF file
        pdf.Save(outStream);
        // Convert the document to byte form. 
        byte[] docBytes = outStream.ToArray();
        outStream.Close();
        return docBytes;

Hi Kristan,


Thanks for your inquiry. It is recommended to use new DOM approach for HTML to PDF conversion. You may pass basepath of external resources(CSS/Images/Fonts etc) to HtmlLoadOptions object, when converting HTML to PDF. Hopefully it will help you to resolve the issue. However if the issue persist then please share your resource files(html,images) here, so we look into it and will guide you accordingly.

We are sorry for the inconvenience.

Best Regards,