✅ Anyone know the best free way for me to take a page from my site and turn it into a pdf in Blazor?
Title says it all
7 Replies
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Print to pdf
Depends, does it need to be served as an already complete pdf file that one click downloads?
Or is a print button -> save as pdf acceptable?
ChromeHtmlToPdf 4.1.3
ChromiumHtmlToPdf is a 100% managed C# library that can be used to convert HTML to PDF or PNG format with the use of Google Chrome or Microsoft Edge
A potential major consideration for programmatically printing html to pdf is that the page you're looking at may be fundamentally different at a data point level printed at a later time, even minutes later
I'm a fan of using print css and a button to open up the print dialogue
@media print { ... }
css let's you have custom styles specifically for when your page is being printed, extremely powerful when you learn how to use it.
https://developer.mozilla.org/en-US/docs/Web/Guide/PrintingMDN Web Docs
Printing - Developer guides | MDN
There may be times in which your website or application would like to improve the user's experience when printing content. There are a number of possible scenarios:
There aren't great free ways tbh, you can go with an older quest pdf license. But generally in my experience free and pdf don't go together.