Skip to content

Instantly share code, notes, and snippets.

@jtheisen
Created June 18, 2019 15:43
Show Gist options
  • Save jtheisen/5b617a1cac3d72d908730163372546e2 to your computer and use it in GitHub Desktop.
Save jtheisen/5b617a1cac3d72d908730163372546e2 to your computer and use it in GitHub Desktop.
var rows = String.Join("", Enumerable.Range(1, 100).Select(i => $"<tr><td>row #{i}</td></tr>").ToArray());
var html = $@"
<div>
<table>
<thead>
<tr>
<td>header</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<table>
<thead>
<tr>
<td>header2</td>
</tr>
</thead>
<tbody>
{rows}
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
";
var Renderer = new IronPdf.HtmlToPdf();
var pdf = Renderer.RenderHtmlAsPdf(html);
var OutputPath = @"c:\users\jens\downloads\test.pdf";
pdf.SaveAs(OutputPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment