create pdf report from html

  • Hello all, I am new with c# and jsreport. I try to create a pdf report from html, but the pdf i get is the html syntax. Did I did it wrong? i follow some tutorial in youtube.

    var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create();

                var report = await rs.RenderAsync(new RenderRequest()
                    Template = new Template()
                        Recipe = Recipe.PhantomPdf,
                        Engine = Engine.Handlebars,
                        Content = "<html>
                                  		<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
                                		<style type='text/css'>
                                  			a {text-decoration: none}
                                              <img src='gnr.html_files/img_0_0_0' style='height: 22px' alt=''/>
                }); ;
                using (var savedFile = File.Create("GNR-.pdf"))

  • Please use Recipe = Recipe.ChromePdf instead of Recipe = Recipe.PhantomPdf, with jsreport v2

  • Hi jan_blaha, I already use Recipe.ChromePdf, but I still get the same result, a pdf contain all html code inside.

  • Works for me... Don't you pass the html encoded? I used this...

    Template = new Template()
                        Recipe = Recipe.ChromePdf,
                        Engine = Engine.Handlebars,
                        Content = @"<html>

  • Yes it's work. It's my false to write <html> into < html> with space. Thank you so much

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.