HTML Formatting for Receipt Templates
Overview
Evergreen receipt templates use HTML for formatting, allowing you to control how text appears on printed receipts. This guide covers the essential HTML tags and techniques you’ll need to create professional-looking receipts.
|
You don’t need to be a web developer to customize receipts. The examples in this guide can be copied and modified to suit your library’s needs. |
Basic Text Formatting
| Tag | Purpose | Example | Output |
|---|---|---|---|
|
Line break (like pressing Enter) |
|
Welcome! |
|
Horizontal line separator |
|
Items: |
|
Bold text |
|
Due Date |
|
Italic text |
|
Title |
|
Underlined text |
|
Important |
|
Paragraph with spacing |
|
New paragraph |
Text Alignment
Lists
Numbered Lists
Use numbered lists to display items with automatic numbering:
<ol>
<li ng-repeat="checkout in circulations">
<div>{{checkout.title}}</div>
<div>Barcode: {{checkout.copy.barcode}}</div>
<div>Due: {{checkout.circ.due_date}}</div>
</li>
</ol>
Output Example:
1. The Great Gatsby Barcode: 31234567890 Due: 12/29/2024 2. To Kill a Mockingbird Barcode: 31234567891 Due: 12/29/2024
Tables
Tables are useful for organizing billing information and creating aligned layouts:
<table width="100%">
<tr>
<td>Title:</td>
<td>{{checkout.title}}</td>
</tr>
<tr>
<td>Barcode:</td>
<td>{{checkout.copy.barcode}}</td>
</tr>
<tr>
<td>Balance:</td>
<td>{{xact.summary.balance_owed | currency}}</td>
</tr>
</table>
Output Example:
Title: The Great Gatsby Barcode: 31234567890 Balance: $5.00
Advanced Formatting
Text Size
Control text size for better visibility:
Combining Styles
You can combine multiple formatting options:
Special Characters in HTML
Some characters have special meaning in HTML and need to be encoded:
| Character | HTML Code | Usage |
|---|---|---|
|
|
Less than symbol |
|
|
Greater than symbol |
|
|
Ampersand |
|
|
Quotation mark |
Space (non-breaking) |
|
Prevents line breaks |
Working with Macros in HTML
Evergreen macros (the {{}} placeholders) can be embedded anywhere in your HTML:
<!-- Simple macro in text -->
<p>Welcome {{patron.first_given_name}}!</p>
<!-- Macro with formatting -->
<b>Card Number:</b> {{patron.card.barcode}}<br/>
<!-- Macro in table -->
<table>
<tr>
<td>Balance Due:</td>
<td><b>{{xact.summary.balance_owed | currency}}</b></td>
</tr>
</table>
|
Always test your HTML changes with the preview feature before saving. The preview shows how your receipt will look with sample data. |
Best Practices for Receipt HTML
| Practice | Reason |
|---|---|
Keep HTML simple |
Receipts print on thermal printers with limited formatting support |
Use relative sizes |
Allows receipts to scale properly on different printer models |
Test with actual data |
Preview may not show all edge cases |
Avoid complex CSS |
Not all CSS properties work on thermal printers |
Use consistent formatting |
Creates professional, uniform receipts across all types |
Troubleshooting HTML Issues
| Problem | Solution |
|---|---|
Text appears as code |
Check for unclosed tags (missing |
Formatting not showing |
Verify HTML tags are properly nested |
Receipt too wide |
Remove fixed widths or use percentages |
Spacing issues |
Use |
Special characters display wrong |
Use HTML entities for |
Related Documentation
-
Configuring Receipt Templates - Main receipt template configuration
-
Printing Setup - Printer configuration
-
HTML Tutorial - Complete HTML reference
Next Steps
Now that you understand HTML formatting for receipts:
-
Return to Configuring Receipt Templates to apply your knowledge
-
Experiment with the preview feature to see results instantly
-
Start with small changes and build complexity gradually
-
Save backups of working templates before making major changes