Last active
August 29, 2015 14:04
-
-
Save pofider/7ae21d7c1ea4542d8ce9 to your computer and use it in GitHub Desktop.
Using jsreport .net client api to convert pure html into pdf stream.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task GetBackPdfStreamFromPureHtml() | |
{ | |
var reportingService = new ReportingService("http://localhost:2000"); | |
var report = await reportingService.RenderAsync(new RenderRequest() | |
{ | |
template = new Template() | |
{ | |
content = "<h1>pure html</h1", | |
recipe = "phantom-pdf", | |
engine = "handlebars" | |
} | |
}); | |
using (var reader = new StreamReader(report.Content)) | |
{ | |
var pdf = reader.ReadToEnd(); | |
Assert.IsTrue(pdf.StartsWith("%PDF")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment