Convert HTML to PDF by Using Chrome in ASP.NET
Project Site:
github.com
Tutorial:
adriancs.com
|
CodeProject.com
Load Sample HTML:
Acknowledgement of The Origin of HTML Sample, Special Thanks to:
htmlpdfapi.com
and Document Templates provided by Microsoft Word 2021.
Edit HTML Here:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style type="text/css"> h1 { margin: 0; padding: 0; } .page { margin: auto; margin-top: 10mm; border: 1px solid black; width: 18cm; height: 27cm; } @page { margin: 0; size: A4 portrait; } </style> </head> <body> <div class="page"> <h1>Page 1</h1> <img src="/pdf.jpg" style="width: 100%; height: auto;" /> </div> <div style="page-break-after: always"></div> <div class="page"> <h1>Page 2</h1> <img src="/pdf.jpg" style="width: 100%; height: auto;" /> </div> <div style="page-break-after: always"></div> <div class="page"> <h1>Page 3</h1> <img src="/pdf.jpg" style="width: 100%; height: auto;" /> </div> </body> </html>
Generating PDF...