Closed Luk164 closed 1 year ago
I recommend you take a look here: QuestPDF.
I like it a lot.
How did I not find this before? But I still believe having a component would be helpful. Thank you
Hi.
This is out of scope for MudBlazor. We believe it's better to use external packages for this, since this is way too complex and big development. We also have a policy not to use 3rd party libraries or making wrappes around js(like PrintJS), not even saying that most PDF generators are usually not MIT compatible therefore making our own solution would be too challenging.
Feature request type
New component
Component name
MudPrintContainer
Is your feature request related to a problem?
I would like to ask if a dedicated component for printing could be added. I want my users to be able to print data using pre-made .razor templates but I am having trouble with that, especially with headers and footers.
Describe the solution you'd like
Something like this:
The content is to be separated into multiple pages as needed but every page will receive a header and footer of its own.
Have you seen this feature anywhere else?
There are many JS libraries though they are often unsuitable, like PrintJS(dead) and also tools like WeasyPrint and PDFReactor(cloud based and paid) and many others. See: This article and click on the playground link
One of the problems I had with WeasyPrint is there does not seem to be a way to print only a specific element of the page and also it understandably does not support printing blazor pages even with pre-rendering.
Describe alternatives you've considered
For now the only solution for me seems to be using a separate .cshtml template together with WeasyPrint and then returning the resulting pdf file to user, either to download or to preview.
Pull Request
Code of Conduct