HTML to PDF in a Windows universal app (UWP)

Is it possible to convert an HTML chain to a PDF data in a UWP application? I’ve observed tons of various techniques it can be performed in regular.NET applications (there appear to become plenty of 3rd party collections), yet I have actually however to observe a means it could be done in a Universal/UWP application. Carries out any person understand just how it could be done?

Probably there is actually some technique to hook right into the “Microsoft Print to PDF” possibility, if there is no pure code service?

Yes, however using in this manner, you will need to have to first of all present your HTML chain in managements like RichEditBox or even TextBlock, merely UIElement could be printable material.

Or even exists a deviating way of doing it, perhaps like in some way making use of Javascript and https://github.com/MrRio/jsPDF inside a C# UWP application? I am actually not exactly sure, holding at straws …

MSFT as proper for verifying that it IS feasible to convert HTML to PDF, with making use of the Microsoft Print to PDF choice in the printing discussion.

You can additionally produce PDF report through your own self, below is actually essential phrase structure used in PDF

you can easily get the HTML cord and also write the cord in to a TextBlock or some other commands and also print this management. If you fulfill some concern when cultivating PDF ink-jet printer, you can easily upload your code.

When report is actually spare at location all the css for the pdf file receive dropped, convert HTML+ css to PDF along in Asp.net C#.

Convert HTML along with (bootstrap-4) css to PDF Itextsharp in Asp.net C#

What I have done therefore much is actually to convert a webview into a series of webviewbrushes (Structure Elements or even more exclusively they are actually Rectangles). Now that I possess generally attracted the parsed HTML onto a Square, just how complicated is it to then imprint those Rectangles?

To become honestly, making use of Libs or even Internet service to convert HTML to PDF is also a method, there are several as well as I merely hunted for all of them, but I can’t find any sort of free to be used in WinRT. I believe the very most achievable approach listed below is the first one, hooking in to Microsoft Print to PDF.

After that you can develop a PDF documents and also conserve this into this file. But because you wish to convert the HTML to PDF, it could be actually a hard job as well as I think you do not wish to do this.

After transforming report to pdf all the css is lost for the data If there is actually any sort of tool feel free to let me know

Total page number while transformation from HTML to PDF

using (var doc = new iTextSharp.text.Document(PageSize.A4, 10, 10, 80, 60))
                {
                    using (var writer = PdfWriter.GetInstance(doc, ms))
                    {
                        writer.PageEvent = new Common.Classes.iTextEvents;                         
                        doc.Open();                 
                        using (var msCss = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(css)))
                        {
                            using (var msHtml = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(HTML)))
                            {
                                doc.NewPage();
                            }
                        }
                        doc.Close();
                    }
                }
                bytes = ms.ToArray();

Leave a Reply

Your email address will not be published. Required fields are marked *