Frappe Syntax Print logo

Frappe Syntax Print

Organization
Impertio-Studio
frappe-syntax-print

Use when creating print formats or generating PDFs in Frappe v14-v16. Covers Jinja print formats, Print Designer [v15+], Letter Head, PDF generation API (get_pdf, download_pdf), Report print formats ({%= %} syntax), page breaks, and print CSS patterns. Prevents common mistakes with template engine confusion and PDF rendering. Keywords: print format, PDF, get_pdf, Jinja, Letter Head, print designer,, PDF not generating, print format broken, custom PDF, letter head, wkhtmltopdf error. wkhtmltopdf, WeasyPrint, page-break, download_pdf.

Overview

PublisherImpertio-Studio
RepositoryFrappe_Claude_Skill_Package
Skill namefrappe-syntax-print
Stars
180
Forks
53
Bundled files
3
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.

  • 3 bundled files

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

  • Open source

    Published by Impertio-Studio on GitHub. Read the source before you install it.

Installation

Install the Frappe Syntax Print 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/Impertio-Studio/Frappe_Claude_Skill_Package.git /tmp/Frappe_Claude_Skill_Package
mkdir -p .claude/skills
cp -r /tmp/Frappe_Claude_Skill_Package/skills/source/syntax/frappe-syntax-print .claude/skills/frappe-syntax-print
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Frappe Syntax Print 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 Frappe Syntax Print 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 Frappe Syntax Print 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 Print Formats & PDF Generation

Deterministic reference for print formats, Letter Head, and PDF generation in Frappe v14/v15/v16.


When to Use This Skill

USE when:

  • Creating or modifying Print Formats (Jinja or JS)
  • Generating PDFs programmatically (get_pdf, download endpoints)
  • Configuring Letter Head (header/footer) for print output
  • Working with Print Designer (v15+)
  • Implementing page breaks, print CSS, or landscape layouts
  • Building Report Print Formats ({%= %} syntax)

DO NOT USE for:

  • General Jinja template syntax (emails, portals) -- see frappe-syntax-jinja
  • Client Script UI logic -- see frappe-syntax-clientscripts
  • Web views or portal pages -- see frappe-syntax-jinja

Decision Tree: Which Print Format Type?

Need a printable/PDF document?
├─ YES → Is it a Query/Script Report?
│        ├─ YES → Use JS Template ({%= %} microtemplate)
│        │        Set print_format_for = "Report"
│        └─ NO  → Need visual drag-and-drop editor?
│                  ├─ YES → On v15+?
│                  │        ├─ YES → Use Print Designer (WeasyPrint)
│                  │        └─ NO  → NOT available on v14. Use Jinja.
│                  └─ NO  → Need full layout control?
│                           ├─ YES → Use Jinja Print Format (custom_format=1)
│                           └─ NO  → Use Standard Print Format (auto layout)
└─ NO  → This skill does not apply.

Print Format Types

TypeEngineVersionWhen to Use
StandardAuto from DocType field layoutv14+No customization needed
JinjaServer-side Jinja2 (wkhtmltopdf)v14+Full layout control
JS TemplateClient-side microtemplatev14+Report print formats only
Print DesignerWeasyPrint / Chromev15+Visual drag-and-drop builder

Standard Print Format

ALWAYS the default. Frappe auto-generates layout from DocType fields. No code needed. Controlled via Print Settings and field print_hide property.

Jinja Print Format

Set custom_format = 1 on the Print Format document. Full Jinja2 with server-side rendering.

Context variables available in every Jinja Print Format:

VariableTypeContent
docDocumentThe document being printed
metaMetaDocType metadata
layoutlistField layout sections
letter_headstrRendered Letter Head HTML
footerstrRendered footer HTML
print_settingsdictPrint Settings configuration
frappemoduleFull frappe module access

Example — Minimal Jinja Print Format:

html
<h1>{{ doc.name }}</h1>
<p>Customer: {{ doc.customer_name }}</p>
<p>Date: {{ doc.posting_date | global_date_format }}</p>

<table class="table table-bordered">
  <thead>
    <tr><th>Item</th><th>Qty</th><th>Rate</th><th>Amount</th></tr>
  </thead>
  <tbody>
    {% for row in doc.items %}
    <tr>
      <td>{{ row.item_name }}</td>
      <td>{{ row.qty }}</td>
      <td>{{ frappe.utils.fmt_money(row.rate, currency=doc.currency) }}</td>
      <td>{{ frappe.utils.fmt_money(row.amount, currency=doc.currency) }}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>

<p><strong>Grand Total:</strong> {{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }}</p>

JS Template (Report Print Formats)

ONLY for Query Reports and Script Reports. Uses {%= %} microtemplate syntax, NOT Jinja.

javascript
// In report's .js file
{%= row.item_name %}
{% if (row.qty > 10) { %}
  <strong>Bulk order</strong>
{% } %}

{% for (var i = 0; i < rows.length; i++) { %}
  <tr>
    <td>{%= rows[i].item_name %}</td>
    <td>{%= rows[i].qty %}</td>
  </tr>
{% } %}

CRITICAL: NEVER mix Jinja {{ }} and JS {%= %} syntax. They are completely separate template engines.

Print Designer (v15+ Only)

  • Separate app: bench get-app print_designer
  • Uses WeasyPrint (not wkhtmltopdf)
  • Visual drag-and-drop builder in the browser
  • NEVER attempt to use Print Designer on v14 -- it does not exist

Letter Head

Letter Head provides consistent header/footer across all print formats.

Configuration

FieldPurpose
source"Image" or "HTML"
contentHeader HTML (Jinja-rendered with doc context)
footerFooter HTML (Jinja-rendered, PDF only)
imageHeader image (when source = "Image")
alignImage alignment: Left, Center, Right

IMPORTANT: The footer field only displays in PDF output, never in browser print preview.

Letter Head in Jinja Templates

python
# Server-side: render Letter Head programmatically
from frappe.utils.print_format import render_letterhead_for_print

letterhead_html = render_letterhead_for_print(
    letter_head_name="My Company",
    doc=doc
)

Dynamic Letter Head Content

Letter Head content and footer fields support Jinja with doc context:

html
<!-- In Letter Head content field -->
<div style="text-align: right;">
  <strong>{{ doc.company }}</strong><br>
  Date: {{ doc.posting_date | global_date_format }}
</div>

PDF Generation API

See references/pdf-api.md for complete API reference.

Quick Reference

python
# Generate PDF bytes from HTML
from frappe.utils.pdf import get_pdf
pdf_bytes = get_pdf(html_string, options=None)

# Generate PDF from a specific document + print format
from frappe.utils.print_format import download_pdf
download_pdf(doctype, name, format=None, doc=None, no_letterhead=0)

Download Endpoints

# Single document PDF
GET /api/method/frappe.utils.print_format.download_pdf
    ?doctype=Sales Invoice
    &name=SINV-00001
    &format=My Print Format
    &no_letterhead=0

# Multiple documents in one PDF
GET /api/method/frappe.utils.print_format.download_multi_pdf
    ?doctype=Sales Invoice
    &name=["SINV-00001","SINV-00002"]
    &format=My Print Format

PDF Engine Selection (v15+)

EngineWhenConfig
wkhtmltopdfDefault on v14, fallback on v15+Default
Chromev15+ with Chromium installedpdf_generator = "chrome" on Print Format
WeasyPrintPrint Designer formats onlyAutomatic for Print Designer

ALWAYS use wkhtmltopdf on v14. On v15+, Chrome produces better CSS3 support.


Page Breaks & Print CSS

Page Break Classes

html
<!-- Force page break after this element -->
<div class="page-break"></div>

<!-- Or use CSS directly -->
<div style="page-break-after: always;"></div>

<!-- Page break before -->
<div style="page-break-before: always;"></div>

Print CSS Classes (Frappe Built-in)

ClassEffect
.print-formatContainer: max-width 8.3in, min-height 11.69in (A4 portrait)
.print-format.landscapeWidth 11.69in (A4 landscape)
.page-breakpage-break-after: always
.print-headingPrint title styling
.hidden-pdfHidden in PDF output only
.visible-pdfVisible in PDF output only

PDF Header/Footer HTML

python
# In hooks.py — inject header/footer into every PDF
pdf_header_html = "myapp.utils.get_pdf_header"
pdf_body_html = "myapp.utils.get_pdf_body"
pdf_footer_html = "myapp.utils.get_pdf_footer"
html
<!-- Header/footer elements in print format HTML -->
<div id="header-html">
  <span class="page"></span> of <span class="topage"></span>
</div>

<div id="footer-html">
  <p style="text-align: center; font-size: 9px;">
    Printed on {{ frappe.utils.nowdate() }}
  </p>
</div>

Print CSS Best Practices

css
/* ALWAYS use relative units for print widths */
@media print {
  .print-format {
    max-width: 100%;
    margin: 0;
    padding: 15mm;
  }

  /* Prevent table rows from splitting across pages */
  tr {
    page-break-inside: avoid;
  }

  /* Constrain images */
  img {
    max-width: 100%;
    height: auto;
  }
}

Custom App Print Formats

Ship a Print Format with Your App

myapp/
└── mymodule/
    └── print_format/
        └── my_custom_format/
            ├── my_custom_format.json   # Print Format doc
            └── my_custom_format.html   # Jinja template

In the JSON file, ALWAYS set:

json
{
  "doctype": "Print Format",
  "name": "My Custom Format",
  "doc_type": "Sales Invoice",
  "module": "My Module",
  "standard": "Yes",
  "custom_format": 1,
  "print_format_type": "Jinja"
}

ALWAYS set standard = "Yes" and module for app-shipped print formats. This ensures they are recognized as part of the app and not as site-level customizations.


Jinja Filters for Print Formats

FilterPurposeExample
global_date_formatFormat date per system settings{{ doc.posting_date | global_date_format }}
jsonSerialize to JSON string{{ doc.items | json }}
lenGet length{{ doc.items | len }}
intCast to integer{{ value | int }}
fltCast to float{{ value | flt }}
markdownRender Markdown to HTML{{ doc.description | markdown }}
absAbsolute value{{ value | abs }}

Register Custom Jinja Filters/Methods

python
# In hooks.py
jinja = {
    "methods": [
        "myapp.utils.jinja.my_custom_method"
    ],
    "filters": [
        "myapp.utils.jinja.my_custom_filter"
    ]
}
python
# myapp/utils/jinja.py
def my_custom_method(value):
    """Available as {{ my_custom_method(doc.field) }} in templates."""
    return value.upper()

def my_custom_filter(value, arg=None):
    """Available as {{ doc.field | my_custom_filter }} in templates."""
    return f"[{value}]"

Version Compatibility Matrix

Featurev14v15v16
Jinja Print FormatsYesYesYes
JS Report TemplatesYesYesYes
Standard Print FormatsYesYesYes
Letter Head (Image/HTML)YesYesYes
wkhtmltopdfDefaultFallbackFallback
Chrome PDF engineNoYesYes
WeasyPrintNoYesYes
Print Designer appNoYesYes
pdf_header_html hookYesYesYes
download_multi_pdfYesYesYes

Common Anti-Patterns

See references/anti-patterns.md for the complete list with fixes.

  1. NEVER use {{ }} in Report Print Formats -- they use {%= %} (JS microtemplate)
  2. NEVER call frappe.get_doc() inside a {% for %} loop in templates -- causes N+1 queries
  3. NEVER put heavy business logic in Jinja templates -- move to Python and pass results
  4. NEVER hardcode page dimensions in CSS -- use .print-format class or relative units
  5. NEVER ignore the no_letterhead parameter when generating PDFs programmatically
  6. NEVER use Print Designer on v14 -- it requires v15+
  7. NEVER embed large base64 images in print templates -- use URLs with max-width: 100%

Reference Files

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 Frappe Syntax Print AI skill do?

Use when creating print formats or generating PDFs in Frappe v14-v16. Covers Jinja print formats, Print Designer [v15+], Letter Head, PDF generation API (get_pdf, download_pdf), Report print formats ({%= %} syntax), page breaks, and print CSS patterns. Prevents common mistakes with template engine confusion and PDF rendering. Keywords: print format, PDF, get_pdf, Jinja, Letter Head, print designer,, PDF not generating, print format broken, custom PDF, letter head, wkhtmltopdf error. wkhtmltopdf, WeasyPrint, page-break, download_pdf.

Why use Frappe Syntax Print on TypingMind?

Because you install it once and use it with any model. Frappe Syntax Print 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 Frappe Syntax Print in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/syntax/frappe-syntax-print. 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 Frappe Syntax Print?

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 Frappe Syntax Print?

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

Is the Frappe Syntax Print AI skill free?

Yes. It is published on GitHub by Impertio-Studio 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 👇