Cannot get external CSS to render with Aspose.Pdf 7.1

Hello again. I’ve got yet another problem with Aspose Pdf. It seems every time I turn around there’s something else I can’t do with this product. I am trying to do an “Html to Pdf” conversion and cannot seem to get any css to come through from an external css link. I came across some posts from other forum users that sounded like they were having a similar problem. It was apparently written up as an issue in your system and then supposedly fixed with the 7.1 release. I have just downloaded and pointed my sandbox app to the new dll but nothing changed as far as my content.


I have attached a zip with a sample project. The HtmlToPdf.aspx has two buttons on it: YC and Aspose. The YC button tries to convert the local file “test.html” which has an external css pointed to the local “YCcss.css” file. The Apose button tries to convert the local file “test2.html” which has an external css pointed to the local “test.css” file. NOTE: The Aspose button is firing the online example found in your documentation at: Convert PDF documents using C# API|Aspose.PDF for .NET

Please provide a fix or let me know what I’m missing in order to make this work. Thanks.

Hi David,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample application.

I checked your issue and I am able to reproduce the issue. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34065. As a work around, you may provide the complete path of the CSS file in your HTML file as it works fine. We will notify you via this forum thread regarding any updates against your issue.

Sorry for the inconvenience,

Can you be a bit more specific/descriptive when explaining the “workaround” to me? I’ve tried using the two examples below as “complete paths” to the CSS file.



and


Neither seems to have any effect on the rendered pdf. Can you provide me with a working example of what you’re talking about?

Thanks.

Hi David,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Following is the path of the CSS file I set in the HTML file.

Please try it and let me know if it works fine.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-34065) 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.

Hi David,


In reference to above fix, Please use new DOM approach for HTML to PDF conversion, it will help you to accomplish the task.

// Specify the The
base path/url for the css,images etc
<o:p></o:p>

String basePath = “C:/temp/”;<o:p></o:p>

HtmlLoadOptions htmloptions
= new HtmlLoadOptions(basePath);<o:p></o:p>

// use the new
conversion engine
<o:p></o:p>

htmloptions.UseNewConversionEngine
= true;<o:p></o:p>

// load HTML file<o:p></o:p>

Document doc = new Document(“input.html”, htmloptions);<o:p></o:p>

// Save HTML file<o:p></o:p>

doc.Save(“output.pdf”);<o:p></o:p>


Please feel free to contact us for any further assistance.


Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan