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

Free Support Forum - aspose.com

Generate HTML to PDF - JavaScript files

Hi,
I am using Aspose.PDF.Generator and I want to convert HTML pages to PDF. The HTML page is built using JavaScript files. Is it possible to do this? If so, how do I get the javascript to work? Do you have any examples referencing JavaScript files? I am reading the HTML from a MemoryStream using the URL.

My HTML code contains code like this:



Thanks

Hi Jason,


Thanks for your inquiry. I am afraid the requested feature is not supported at the moment in Aspose.Pdf. However, we have already logged a feature request as PDFNEWNET-34390 for support of JavaScript in HTML to PDF conversion. We will notify you as soon as it is implemented.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-34390) have been fixed in Aspose.Pdf for .NET 9.3.0.

Blog post for this release can be viewed over this link


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,


I have the similar problem and cannot find what features are actually supported during conversion.
I am usung Aspose.PDF version 11 and trying to generate .pdf from some html file with dynamic content. Sample JS code is:


function load()
{
var x = document.getElementsByTagName(“BODY”);
var node = document.createElement(“H1”);
var textnode = document.createTextNode(“I am javascript”);
node.appendChild(textnode);
x[0].appendChild(textnode);
}
//full file is in the attachment

C# code is:

// The path to the documents directory.
string dataDir = “D:\projects\AsposePdfTest”;

// Specify the The base path/url for the html file which serves as images database
String basePath = “D:\projects\AsposePdfTest”;
HtmlLoadOptions htmloptions = new HtmlLoadOptions(basePath);
// Load HTML file
Document doc = new Document(Path.Combine(dataDir, “test1.html”), htmloptions);
// Save HTML file
doc.Save(Path.Combine(dataDir, “HTMLToPDF_out.pdf”));

Can it work as it is required for me? Where to find supported features?

Hi Andrey,


Thanks for your inquiry. We are looking into it and will update you soon.

Best Regards,

Hi Andrey,


I have tested HTML to PDF conversion scenario using your shared HTML and noticed JavaScript code is not executed during the conversion, so we have linked your post to the issue PDFNEWNET-38447 logged for the purpose.

Furthermore, new DOM approach for HTML to PDF conversion supports almost all the feature of HTML and HTML5 along with CSS3.

We are sorry for the inconvenience caused.

Best Regards,