C
C#7mo ago
Gecko

✅ 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
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Mayor McCheese
Mayor McCheese7mo ago
Print to pdf
PixxelKick
PixxelKick7mo ago
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?
Mayor McCheese
Mayor McCheese7mo ago
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
Mayor McCheese
Mayor McCheese7mo ago
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
PixxelKick
PixxelKick7mo ago
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/Printing
MDN 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:
Mayor McCheese
Mayor McCheese7mo ago
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.