Skip to main content

Introduction: What Is a Print Format for Reports in Frappe?

A print format for reports in Frappe Framework v15 defines how report data is rendered when users print or export a report as PDF.

Unlike DocType print formats (used for documents like Sales Invoice), report print formats control the layout, structure, and presentation of query reports and script reports when printed.

This feature allows reports to be:

  • Professionally formatted
  • Printable as PDFs
  • Consistent with business branding

Why Use Print Formats for Reports?

Print formats for reports are used to:

  • Convert tabular report data into printable layouts
  • Share reports with external stakeholders
  • Maintain consistent reporting standards
  • Generate audit-ready or management-ready documents

Without a print format, reports are rendered in a basic tabular layout.

How Report Printing Works in Frappe v15

When a user clicks Print on a report:

  1. Frappe checks if a print format is defined for the report
  2. If available, the print format template is applied
  3. Report data is passed to the template
  4. Output is rendered as HTML or PDF

This process is entirely server-side and does not require client-side scripting.

Which Reports Support Print Formats?

Print formats can be used with:

  • Query Reports
  • Script Reports

Report Builder reports do not support custom print formats.

How to Add a Print Format to a Report (Step-by-Step)

Step 1: Open the Report

Answer:
Go to Report List → Open the Report you want to print.

Ensure the report type is Query Report or Script Report.

Step 2: Define the Print Format

In the report form:

  • Scroll to the Print Format field
  • Select an existing print format or
  • Create a new print format for the report

The print format must be of type Report.

Step 3: Save the Report

Once linked, the report will use this print format whenever it is printed.

How Data Is Available Inside Report Print Formats

Inside a report print format template, data is available as:

  • columns → Column definitions
  • data → Row data

These variables are injected automatically by Frappe.

Example: Basic Report Print Format Template

<h2>Sales Summary Report</h2>
<table border="1" width="100%">
<tr>
{% for column in columns %}
<th>{{ column.label }}</th>
{% endfor %}
</tr>
{% for row in data %}
<tr>
{% for column in columns %}
<td>{{ row[column.fieldname] }}</td>
{% endfor %}
</tr>
{% endfor %}
</table><

This template renders report data dynamically without additional queries.

How Report Print Formats Differ from DocType Print Formats

Aspect Report Print Format DocType Print Format
Data Source Report result Document (doc)
Variables columns, data doc, doc.items
Use Case Analytics & summaries Transaction documents
Edit Scope Report-specific DocType-specific

Understanding this distinction prevents misuse of variables.

Best Practices for Report Print Formats

Keep logic minimal
Use report data directly; avoid database calls.

Avoid heavy styling
Complex CSS can slow PDF rendering.

Use column metadata
Rely on column.label and column.fieldname for flexibility.

Test with large datasets
Ensure formatting scales for real-world data volumes.

Common Issues and Troubleshooting

Print option not visible

  • Ensure the report type supports printing
  • Confirm a print format is linked

Data not appearing in print

  • Verify columns and data usage
  • Check fieldnames match report output

PDF layout breaks

  • Reduce nested tables
  • Simplify CSS rules

Industry Relevance and Use Cases

Report print formats are widely used for:

  • Financial summaries and MIS reports
  • Compliance and audit submissions
  • Sales and inventory analytics
  • Management dashboards exported as PDFs

They enable professional reporting without external tools.

Technical Prerequisites

  • Frappe Framework Version 15
  • Query or Script Report configured
  • Print Format access permissions
  • Basic Jinja and HTML knowledge

Conclusion

Print formats for reports in Frappe Framework v15 provide a clean, flexible way to convert raw report data into structured, printable documents. By leveraging built-in variables like columns and data, developers can create professional PDF outputs without additional backend logic.
For ERPNext and Frappe implementations, report print formats are essential for presentation-ready analytics and compliance reporting.

Rating: 5 / 5 (1 votes)