I am having trouble finding a working solution for printing a PDF from an html page in an ASP.Net Core MVC Web application.
There were an article talking about printing custom header and footer in the document its a mix of using an html element and with the CSS style position: fixed. Which is working great. But in order for this to work I have to print the page, like pressing ctrl+p then printing so I could save as pdf.
When I searched about saving HTML to PDF I found many libraries that can do that but actually its taking the HTML content and converting it to PDF so I am losing many styles during this process and some elements do not appear, I tried Rotativa, PdfSharp, and many other libraries.
But what I want is that I want to use the default print then save it as PDF or rather print it as PDF I also tried to search for JavaScript solution I found some that states that I could use window.print()
but how do I set the output to save as PDF then show a browse dialog to the user to save the PDF I didn’t find any.