Hi All!
I am trying to export a blazor server page to PDF. The content of the page is being exported correctly unfortunately it is missing all the styles. I am aware that Blazor generates a .css file with the styles on build and I was able to retrieve most of them using a js function and inject them into the html code I pulled using another function. When I open that html file the styling is correct but when generating the PDF with
Converter.ConvertHTML(styledHtml, “.”, new PdfSaveOptions(), Path.Combine(outputDirectory, fileName));
it does not work - it has no styling at all. Could you please point me to a solution or a code sample how to keep the styling of a blazor server page when exporting to PDF.
Many thanks!
@budinho
Could you share htmlpage that you are trying to convert so we can investigate such scenario in our environment?
Also do I understand correctly that css file is embedded to html file?
@ilyazhuykov Thanks for the quick response! I just realised that there is no styles embedded in the html file that I pulled using
document.documentElement.outerHTML
I retrieved the css styles and embedded them (from the blazor page but still it looks like some are missing (please see the html attached).
htmlExport.zip (9.0 KB)
Is there any easy way to export blazor page to html with Aspose?
@budinho
I’ll investigate this issue and write you as soon as possible
@budinho
Is it possible for you to provide original of blazor page to compare with resulting html?
Overall, it seems that we don’t have such functionality - the main focus is to process prepared html page to PDF