Printing Templates logo

Printing Templates

Organization
lubusIN
printing-templates

Build print formats, email templates, and web page templates using Jinja. Generate PDFs and configure letter heads. Use when creating custom print layouts, email templates, or any Jinja-based rendering in Frappe.

Overview

PublisherlubusIN
Repositoryfrappe-skills
Skill nameprinting-templates
Stars
62
Forks
23
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by lubusIN on GitHub. Read the source before you install it.

Installation

Install the Printing Templates AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lubusIN/frappe-skills.git /tmp/frappe-skills
mkdir -p .claude/skills
cp -r /tmp/frappe-skills/printing-templates .claude/skills/printing-templates
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Printing Templates in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Printing Templates on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Printing Templates is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Frappe Printing & Templates

Create print formats, email templates, and document templates using Jinja in Frappe.

When to use

  • Creating custom print formats for documents
  • Building email templates with dynamic content
  • Generating PDFs from documents
  • Using Jinja templating in web pages
  • Configuring letter heads for branding
  • Using the Print Format Builder

Inputs required

  • Target DocType for the print format
  • Layout requirements (fields, tables, headers)
  • Whether format is standard (version controlled) or custom (DB-stored)
  • Letter Head / branding requirements
  • PDF generation needs

Procedure

0) Choose format type

TypeHow to CreateVersion ControlledCustomizable by User
StandardDeveloper Mode, saved as JSONYesNo
Print Format BuilderDrag-and-drop UINo (DB)Yes
Custom HTML (Jinja)Type "new print format" in awesomebarOptionalDepends

1) Create a Jinja print format

Create via awesomebar → "New Print Format":

  1. Set a unique name
  2. Link to the target DocType
  3. Set "Standard" = "No" (or "Yes" for dev mode export)
  4. Check "Custom Format"
  5. Set Print Format Type = "Jinja"
  6. Write your Jinja HTML
jinja
<div class="print-format">
    <h1>{{ doc.name }}</h1>
    <p><strong>{{ _("Customer") }}:</strong> {{ doc.customer }}</p>
    <p><strong>{{ _("Date") }}:</strong> {{ frappe.format_date(doc.transaction_date) }}</p>

    <table class="table table-bordered">
        <thead>
            <tr>
                <th>{{ _("Item") }}</th>
                <th>{{ _("Qty") }}</th>
                <th class="text-right">{{ _("Rate") }}</th>
                <th class="text-right">{{ _("Amount") }}</th>
            </tr>
        </thead>
        <tbody>
            {% for item in doc.items %}
            <tr>
                <td>{{ item.item_name }}</td>
                <td>{{ item.qty }}</td>
                <td class="text-right">{{ frappe.format(item.rate, {'fieldtype': 'Currency'}) }}</td>
                <td class="text-right">{{ frappe.format(item.amount, {'fieldtype': 'Currency'}) }}</td>
            </tr>
            {% endfor %}
        </tbody>
        <tfoot>
            <tr>
                <td colspan="3" class="text-right"><strong>{{ _("Total") }}</strong></td>
                <td class="text-right"><strong>{{ frappe.format(doc.grand_total, {'fieldtype': 'Currency'}) }}</strong></td>
            </tr>
        </tfoot>
    </table>

    {% if doc.terms %}
    <div class="terms">
        <h4>{{ _("Terms & Conditions") }}</h4>
        <p>{{ doc.terms }}</p>
    </div>
    {% endif %}
</div>

<style>
    .print-format { font-family: Arial, sans-serif; }
    .print-format h1 { color: #333; }
    .print-format table { width: 100%; margin-top: 20px; }
</style>

2) Use Frappe Jinja API

Data fetching in templates:

jinja
{# Fetch a document #}
{% set customer = frappe.get_doc('Customer', doc.customer) %}
{{ customer.customer_name }}

{# List query (ignores permissions) #}
{% set open_orders = frappe.get_all('Sales Order',
    filters={'customer': doc.customer, 'status': 'To Deliver and Bill'},
    fields=['name', 'grand_total'],
    order_by='creation desc',
    page_length=5) %}

{# Permission-aware list query #}
{% set my_tasks = frappe.get_list('Task',
    filters={'owner': frappe.session.user}) %}

{# Single value lookup #}
{% set company_abbr = frappe.db.get_value('Company', doc.company, 'abbr') %}

{# Settings value #}
{% set timezone = frappe.db.get_single_value('System Settings', 'time_zone') %}

Formatting:

jinja
{{ frappe.format(50000, {'fieldtype': 'Currency'}) }}
{{ frappe.format_date('2025-01-15') }}
{{ frappe.format_date(doc.posting_date) }}

Session and context:

jinja
{{ frappe.session.user }}
{{ frappe.get_fullname() }}
{{ frappe.lang }}
{{ _("Translatable string") }}

URLs:

jinja
<a href="{{ frappe.get_url() }}/app/sales-order/{{ doc.name }}">View Order</a>

3) Build email templates

jinja
Dear {{ doc.customer_name }},

Your order {{ doc.name }} has been confirmed.

Items:
{% for item in doc.items %}
- {{ item.item_name }} x {{ item.qty }}
{% endfor %}

Total: {{ frappe.format(doc.grand_total, {'fieldtype': 'Currency'}) }}

Thank you,
{{ frappe.get_fullname() }}

4) Generate PDFs programmatically

python
import frappe

# Generate PDF
pdf_content = frappe.get_print(
    doctype="Sales Invoice",
    name="SINV-001",
    print_format="Custom Invoice",
    as_pdf=True
)

# Attach PDF to document
frappe.attach_print(
    doctype="Sales Invoice",
    name="SINV-001",
    print_format="Custom Invoice",
    file_name="invoice.pdf"
)

# Send with email
frappe.sendmail(
    recipients=["customer@example.com"],
    subject="Your Invoice",
    message="Please find attached your invoice.",
    attachments=[{
        "fname": "invoice.pdf",
        "fcontent": pdf_content
    }]
)

5) Configure Letter Head

  1. Navigate to Letter Head list → New
  2. Upload company logo and header image
  3. Set as default for the company
  4. Letter Head appears automatically on print formats

6) Use Jinja filters

jinja
{{ doc.customer_name|upper }}        {# UPPERCASE #}
{{ doc.notes|truncate(100) }}        {# Truncate text #}
{{ doc.description|striptags }}      {# Remove HTML #}
{{ doc.html_content|safe }}          {# Render raw HTML (trusted only!) #}
{{ items|length }}                   {# Count items #}
{{ items|first }}                    {# First item #}
{{ names|join(', ') }}               {# Join list #}
{{ amount|round(2) }}               {# Round number #}
{{ value|default('N/A') }}          {# Default if undefined #}
{{ data|tojson }}                    {# Convert to JSON #}

7) Template inheritance and macros

jinja
{# macros/fields.html #}
{% macro field_row(label, value) %}
<tr>
    <td class="label"><strong>{{ _(label) }}</strong></td>
    <td>{{ value }}</td>
</tr>
{% endmacro %}

{# In print format #}
{% from "macros/fields.html" import field_row %}
<table>
    {{ field_row("Customer", doc.customer_name) }}
    {{ field_row("Date", frappe.format_date(doc.posting_date)) }}
    {{ field_row("Total", frappe.format(doc.grand_total, {'fieldtype': 'Currency'})) }}
</table>

Verification

  • Print format renders correctly in Print View
  • All fields display with proper formatting
  • PDF generation works without errors
  • Email templates render with correct data
  • Letter Head appears on printed documents
  • Translations work in templates (_())
  • No XSS risks from unescaped content

Failure modes / debugging

  • Template syntax error: Check Jinja delimiters ({{ }}, {% %}); look for unclosed blocks
  • Field not rendering: Verify field name matches DocType schema; check child table access pattern
  • PDF generation fails: Check wkhtmltopdf installation; verify print format Jinja is valid
  • Styling issues in PDF: Use inline styles; avoid complex CSS; test with Print View first
  • Permission error in template: Use frappe.get_all (no permission check) vs frappe.get_list

Escalation

  • For app-level hooks and structure → app-development
  • For DocType schema questions → doctype-development

References

Guardrails

  • Test with actual data: Always preview with real documents; edge cases break templates
  • Handle missing fields gracefully: Use {{ doc.field or '' }} or {% if doc.field %}
  • Use get_url() for images: Never hardcode URLs; use {{ frappe.utils.get_url() }}/files/...
  • Escape user content: Use {{ value | e }} for user-generated content to prevent XSS
  • Keep styling inline: PDF generators don't support external CSS; use inline style attributes

Common Mistakes

MistakeWhy It FailsFix
Wrong Jinja syntaxTemplate error, blank outputUse {{ }} for output, {% %} for logic; check closing tags
Missing filtersRaw data displayedUse frappe.format() or frappe.format_date() for formatting
Hardcoded URLsImages/links break across sitesUse {{ frappe.utils.get_url() }} for absolute URLs
Accessing child table wrongEmpty or errorUse {% for item in doc.items %} not doc.child_table_name
Complex CSS in print formatStyling lost in PDFUse inline styles, simple layouts, <table> for structure
Not handling None values'None' string in outputUse {{ value or '' }} or {% if value %}

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Printing Templates AI skill do?

Build print formats, email templates, and web page templates using Jinja. Generate PDFs and configure letter heads. Use when creating custom print layouts, email templates, or any Jinja-based rendering in Frappe.

Why use Printing Templates on TypingMind?

Because you install it once and use it with any model. Printing Templates is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Printing Templates in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/lubusIN/frappe-skills/tree/main/printing-templates. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Printing Templates?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Printing Templates?

As many as you like. As long as a model supports skills, you can use Printing Templates with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Printing Templates AI skill free?

Yes. It is published on GitHub by lubusIN under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇