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.
***js
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> <head> <title></title> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/> <style type='text/css'> a {text-decoration: none} </style> </head> <body> <img src='gnr.html_files/img_0_0_0' style='height: 22px' alt=''/> </body> </html>" } }); ; using (var savedFile = File.Create("GNR-.pdf")) { report.Content.CopyTo(savedFile); }
-
Please use
Recipe = Recipe.ChromePdf
instead ofRecipe = 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> <head> ...
-
Yes it's work. It's my false to write <html> into < html> with space. Thank you so much