Free Support Forum -

Aspose PDF Shim for .Net Core


We are purchasing a license to use in our .Net core web application. I have found the ViewResult shim in your example that works in .Net standard MVCx. Do you have such a shim for .Net Core? The ViewResult in core is drastically different.

If someone has this, it will save me several hours of research and coding.





Thank you for contacting support.

Would you please elaborate a little more while sharing the links or screenshots for our reference. We will investigate further to help you out.


This is the MVC5 shim code. I understand everything it is doing. However, Core ViewResult is very different. Has anyone created a similar shim for displaying a .Net Core Razor View as PDF?

If not, i’ll build it myself this weekend. I prefer to borrow rather than create.



Thank you for the details.

We are afraid similar showcase may not be available and you may build it as per your requirements.


I have redeveloped the shim for .Net Core 2.2.

It is loading the web site’s base URL in HtmlLoadOptions. However, the rendered PDF is missing all the markup from the CSS files in the HTML.

I am stopping the PO if I cannot get this to work.



Would you please share a sample application containing SSCCE code so that we may try to reproduce the problem and help you out.


i can share a webex with you to walk through it. it would take too long to rewrite a sanitized version of this. I can’t even share the output b/c it has PII.

It is successfully converting the HTML that has been extracted as text. However, non of the external CSS in that HTML are being applied.

Is this a limitation of the temporary license?



We are afraid that the support is provided via forums only so the webex may not be an option. Moreover, a narrowed down sample will help us assist you efficiently without necessarily dealing with irrelevant details. Furthermore, you may try to pass basepath, where the HTML file exists, to the constructor of HtmlLoadOptions class as under and then share if the CSS apply or not.

//We intend to demonstrate use of basepath/baseURL in first line here
Aspose.Pdf.HtmlLoadOptions objLoadOptions = new Aspose.Pdf.HtmlLoadOptions(dataDir);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "Test.html", objLoadOptions);

About temporary license, no evaluation limitations apply if temporary license is set successfully in your code so this is not a limitation.

        // the following is my attempt to set a base path. An example of a base path would help.
        var url = $"{context.HttpContext.Request.Scheme}://{context.HttpContext.Request.Host}/";

        // the following converts an MVC view to html text
        string html = controller.RenderViewAsync(ViewName, Model).Result;

        if (Options == null)
            Options = new HtmlLoadOptions(url);

        var pdfDocument = new Document(new MemoryStream(Encoding.UTF8.GetBytes(html)), Options);

        using (var streamOut = new MemoryStream())
            streamOut.Seek(0, SeekOrigin.Begin);
            var result = new FileContentResult(streamOut.ToArray(), "application/pdf")
                FileDownloadName = FileDownloadName
            return result.ExecuteResultAsync(context);



Would you please share the HTML and CSS file along with generated PDF document as a single ZIP file so that we may investigate and assist you accordingly.