Our HTML renders correctly in the browser, as shown in the attached screenshot:
Screenshot 2026-01-07 144840.png (11.3 KB)
However, when we generate the image using Aspose, the output looks different, as shown here:
6_e08c4258-c6b7-4083-9d47-b66c883aadf2_output.png (79.8 KB)
a { text-decoration: none; color: #464feb; } tr th, tr td { border: 1px solid #e6e6e6; } tr th { background-color: #f5f5f5; }
We are new to using Aspose. Previously, we used Selenium WebDriver without any issues resizing textareas. Our page includes a JavaScript script that dynamically resizes all textareas, which seems to work fine in the browser but not in the Aspose-generated image.
Could you please advise how to ensure that JavaScript-based resizing is applied when rendering with Aspose? Are there specific settings or steps we need to enable JavaScript execution or adjust the viewport?
This is the html code :
<textarea name='txt_36574_36574' customtype='42' data-qid='36574' data-qparentid='-1' readonly class='ta_custom1 ctrl_base' wrap='on' style='width:150px; height: auto; ' data-masked='' >tttt
t
t
t
t
tt
t</textarea>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.7.1.min.js"></script>
<script>
$("textarea").each(function () {
this.style.height = this.scrollHeight + "px";
this.style.overflowY = "hidden";
}).on("input", function () {
this.style.height = "auto";
this.style.height = this.scrollHeight + "px";
});
htmlLicense.SetLicense(HttpContext.Current.Server.MapPath("~") & "\bundles\Aspose.HTML.NET.lic")
Dim FilGuidname As String = HttpContext.Current.Session("brugerid") & "_" & Guid.NewGuid().ToString
Dim documentPath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory & "App_Data\", FilGuidname & "_answer.html")
Dim savePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory & "App_Data\", FilGuidname & "_output.png")
File.WriteAllText(documentPath, html)
Dim imagebytes() As Byte = Nothing
Using document As New Aspose.Html.HTMLDocument(html, ".")
If document.ReadyState = "complete" Then
Dim pdfOptions As New ImageSaveOptions(ImageFormat.Jpeg)
pdfOptions.BackgroundColor = System.Drawing.Color.Beige
pdfOptions.Css.MediaType = MediaType.Print
pdfOptions.PageSetup.PageLayoutOptions = PageLayoutOptions.UseWidestPage
pdfOptions.PageSetup.ScaleLimit = 0.8
pdfOptions.PageSetup.AnyPage.Margin.Left.SetAuto()
Converter.ConvertHTML(document, pdfOptions, savePath)
imagebytes = File.ReadAllBytes(savePath)
End If
End Using
Return imagebytes