Skip to content

Instantly share code, notes, and snippets.

@pofider
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pofider/7ae21d7c1ea4542d8ce9 to your computer and use it in GitHub Desktop.
Save pofider/7ae21d7c1ea4542d8ce9 to your computer and use it in GitHub Desktop.
Using jsreport .net client api to convert pure html into pdf stream.
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