Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created October 18, 2025 22:30
Show Gist options
  • Save andrewlimaza/a51640717e9fd44d958b867337030a60 to your computer and use it in GitHub Desktop.
Save andrewlimaza/a51640717e9fd44d958b867337030a60 to your computer and use it in GitHub Desktop.
Example template of using Noto Sans JP (Japanese) for PDF Generation
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700&display=swap" rel="stylesheet">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta http-equiv="content-type" content="text-html; charset=utf-8">
<style type="text/css">
html, div, p, table {
font-family: 'Noto Sans JP', sans-serif;
}
#invoice, .meta-table {
width: 700px;
margin: 0 auto;
}
#invoice th, #invoice td { text-align: left; }
.alignright { text-align: right !important; }
.alignleft { text-align: left !important; }
table { border-collapse: collapse; }
#heading {
font-size: 18px;
color: #555;
background: #EEE;
}
#heading th {
padding: 5px;
border-radius: 2px;
}
.row { border-bottom: 1px solid #eee; }
.row td, .row th { padding: 12px; }
#invoice tr > td:last-child,
#invoice tr > th:last-child {
text-align: right !important;
}
</style>
</head>
<body>
<div>{{logo_image}}</div>
<h1 style="text-align:center; margin: 0 auto;">{{site}}</h1>
<table class="meta-table">
<tr>
<td><strong>Invoice #:</strong> <span>{{invoice_code}}</span></td>
</tr>
<tr>
<td><strong>Date:</strong> <span>{{invoice_date}}</span></td>
</tr>
<tr>
<td><strong>Payment Method:</strong> <span>{{payment_method}}</span></td>
</tr>
</table>
<br/>
<div class="meta-table">{{billing_address}}</div>
<table id="invoice">
<tr id="heading" class="row">
<th class="alignleft" colspan="2"><div>Item</div></th>
<th class="alignright"><div>Price</div></th>
</tr>
<tr class="row">
<td colspan="2" class="alignleft"><div>{{membership_level}}</div></td>
<td class="alignright"><div>{{total}}</div></td>
</tr>
<tr class="row">
<th colspan="2" class="alignright"><div>Subtotal</div></th>
<td class="alignright"><div>{{subtotal}}</div></td>
</tr>
<tr class="row">
<th colspan="2" class="alignright"><div>Tax</div></th>
<td class="alignright"><div>{{tax}}</div></td>
</tr>
<tr class="row">
<th colspan="2" class="alignright"><div>Total</div></th>
<th class="alignright"><div>{{total}}</div></th>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment