How to refer to Css file

Hi to everyone.
Can someone explain to me how does the Css file reference works when I export an Html to Pdf?
I tried to set the HtmlInfo.ExternalResourcePath but it seems not working…

This is the html string:

and I try to set the property with the following values:

or “Content”
or “/Content/”

but the result is aways the same (I’m using an mvc 4 application).
Of cource the correct url for the css is http://localhost:xxx/content/site.css.

I’ve already read the documentation but it is not of great help.

Thanks in advance.

Hi Antonio,

Thanks for contacting support.

In order to use external resource files including CSS, HtmlInfo.ExternalResourcePath property is used. However concerning to above stated issue, can you please share some sample project so that we can test the scenario at our end. We are sorry for this inconvenience.

Here you can find an example:

Thanks for your support.

Hi Antonio,

Thanks for sharing the project.

I am working on replicating this issue and will get back to you soon.

Hi Antonio,

Thanks for your patience.

I have tested the scenario using web application which you have shared and as per my observations, its converting the contents of web page titled Document Title. I have also noticed that the text in resultant PDF is in Time New Roman font and text is not properly aligned. Can you please confirm that you are also getting similar issue. The reason I need your acknowledgment is because we need to be certain that we both are on same page and getting same issues.

For your reference, I have also attached the resultant PDF generated over my end. We are sorry for this delay and inconvenience.

Thanks for support.

I confirm. The pdf is the same.

Hi Antonio,

Thanks for the acknowledgement.

I have logged this problem as PDFNEWNET-36834 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36834) 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 Antonio,

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

HtmlLoadOptions options = new HtmlLoadOptions(externalResourcesBaseUri);<o:p></o:p>

options.UseNewConversionEngine = true;

Document pdfDocument = new Document(inFile, options);


Please feel free to contact us for any further assistance.

Best Regards,