Business Documents

Invoice, report, QR code, barcode, and combined QR/barcode invoice

Invoice

Professional invoice with company header, billing details, itemized table, and totals.

::pdf-example{pdf="/pdfs/examples/18_invoice.pdf"}

{
    "page": {"size": "A4", "margins": "20mm"},
    "metadata": {
        "title": "Invoice #INV-2026-001",
        "author": "ACME Corporation"
    },
    "body": [
        {"row": {"cols": [
            {"span": 6, "elements": [
                {"type": "text", "content": "ACME Corporation", "style": {"size": 24, "bold": true, "color": "#1A237E"}},
                {"type": "text", "content": "123 Business Street"},
                {"type": "text", "content": "Suite 100"},
                {"type": "text", "content": "San Francisco, CA 94105"}
            ]},
            {"span": 6, "elements": [
                {"type": "text", "content": "INVOICE", "style": {"size": 28, "bold": true, "align": "right", "color": "#1A237E"}},
                {"type": "spacer", "height": "3mm"},
                {"type": "text", "content": "#INV-2026-001", "style": {"align": "right", "size": 12}},
                {"type": "text", "content": "Date: March 1, 2026", "style": {"align": "right"}},
                {"type": "text", "content": "Due: March 31, 2026", "style": {"align": "right"}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "spacer", "height": "5mm"},
                {"type": "line", "line": {"color": "#1A237E", "thickness": "2pt"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 6, "elements": [
                {"type": "text", "content": "Bill To:", "style": {"bold": true, "color": "gray(0.4)"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "text", "content": "John Smith", "style": {"bold": true}},
                {"type": "text", "content": "Tech Solutions Inc."},
                {"type": "text", "content": "456 Client Avenue"},
                {"type": "text", "content": "New York, NY 10001"}
            ]},
            {"span": 6, "elements": [
                {"type": "text", "content": "Payment Info:", "style": {"bold": true, "color": "gray(0.4)"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "text", "content": "Bank: First National Bank"},
                {"type": "text", "content": "Account: 1234-5678-9012"},
                {"type": "text", "content": "Routing: 021000021"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "spacer": "10mm"}
        ]}},
        {"row": {"cols": [
            {"span": 12, "table": {
                "header": ["Description", "Qty", "Unit Price", "Amount"],
                "rows": [
                    ["Web Development - Frontend", "40 hrs", "$150.00", "$6,000.00"],
                    ["Web Development - Backend", "60 hrs", "$150.00", "$9,000.00"],
                    ["UI/UX Design", "20 hrs", "$120.00", "$2,400.00"],
                    ["Database Design", "15 hrs", "$130.00", "$1,950.00"],
                    ["QA Testing", "25 hrs", "$100.00", "$2,500.00"],
                    ["Project Management", "10 hrs", "$140.00", "$1,400.00"]
                ],
                "columnWidths": [40, 15, 20, 25],
                "headerStyle": {"bold": true, "color": "white", "background": "#1A237E"},
                "stripeColor": "#F5F5F5"
            }}
        ]}},
        {"row": {"cols": [
            {"span": 12, "spacer": "5mm"}
        ]}},
        {"row": {"cols": [
            {"span": 8},
            {"span": 4, "elements": [
                {"type": "text", "content": "Subtotal:    $23,250.00", "style": {"align": "right"}},
                {"type": "text", "content": "Tax (10%):    $2,325.00", "style": {"align": "right"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "line", "line": {"thickness": "1pt"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "text", "content": "Total:       $25,575.00", "style": {"align": "right", "bold": true, "size": 14}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "spacer", "height": "15mm"},
                {"type": "line", "line": {"color": "gray(0.8)"}},
                {"type": "spacer", "height": "3mm"},
                {"type": "text", "content": "Thank you for your business!", "style": {"align": "center", "italic": true, "color": "gray(0.5)"}}
            ]}
        ]}}
    ]
}

::


Report

Multi-page quarterly report with headers, footers, key metrics, revenue and expense tables.

::pdf-example{pdf="/pdfs/examples/19_report.pdf"}

{
    "page": {"size": "A4", "margins": "20mm"},
    "metadata": {
        "title": "Quarterly Report Q1 2026",
        "author": "ACME Corporation",
        "subject": "Q1 2026 Financial Summary"
    },
    "header": [
        {"row": {"cols": [
            {"span": 6, "text": "ACME Corp", "style": {"bold": true, "size": 9, "color": "#1565C0"}},
            {"span": 6, "text": "Q1 2026 Report", "style": {"align": "right", "size": 9, "color": "gray(0.5)"}}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "line", "line": {"color": "#1565C0"}},
                {"type": "spacer", "height": "3mm"}
            ]}
        ]}}
    ],
    "footer": [
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "spacer", "height": "3mm"},
                {"type": "line", "line": {"color": "gray(0.8)"}},
                {"type": "spacer", "height": "2mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "text": "Confidential - For Internal Use Only", "style": {"align": "center", "size": 7, "color": "gray(0.5)"}}
        ]}}
    ],
    "pages": [
        {"body": [
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "spacer", "height": "20mm"},
                    {"type": "text", "content": "Quarterly Report", "style": {"size": 28, "bold": true, "align": "center", "color": "#1A237E"}},
                    {"type": "text", "content": "Q1 2026 - Financial Summary", "style": {"size": 16, "align": "center", "color": "gray(0.4)"}},
                    {"type": "spacer", "height": "15mm"},
                    {"type": "line", "line": {"color": "#1A237E", "thickness": "2pt"}},
                    {"type": "spacer", "height": "10mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "text", "content": "Executive Summary", "style": {"size": 16, "bold": true}},
                    {"type": "spacer", "height": "3mm"},
                    {"type": "text", "content": "This report presents the financial performance of ACME Corporation for the first quarter of 2026. Revenue increased by 15% compared to Q4 2025, driven primarily by strong growth in the cloud services division. Operating margins improved to 22%, up from 19% in the previous quarter."},
                    {"type": "spacer", "height": "5mm"},
                    {"type": "text", "content": "Key highlights include the successful launch of three new product lines, expansion into the European market, and a 20% reduction in customer churn rate. The company remains well-positioned for continued growth throughout 2026."}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "spacer", "height": "10mm"},
                    {"type": "text", "content": "Key Metrics", "style": {"size": 14, "bold": true}},
                    {"type": "spacer", "height": "3mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 3, "elements": [
                    {"type": "text", "content": "Revenue", "style": {"color": "gray(0.5)", "size": 9}},
                    {"type": "text", "content": "$12.5M", "style": {"size": 18, "bold": true, "color": "#2E7D32"}}
                ]},
                {"span": 3, "elements": [
                    {"type": "text", "content": "Growth", "style": {"color": "gray(0.5)", "size": 9}},
                    {"type": "text", "content": "+15%", "style": {"size": 18, "bold": true, "color": "#2E7D32"}}
                ]},
                {"span": 3, "elements": [
                    {"type": "text", "content": "Customers", "style": {"color": "gray(0.5)", "size": 9}},
                    {"type": "text", "content": "2,450", "style": {"size": 18, "bold": true, "color": "#1565C0"}}
                ]},
                {"span": 3, "elements": [
                    {"type": "text", "content": "Margin", "style": {"color": "gray(0.5)", "size": 9}},
                    {"type": "text", "content": "22%", "style": {"size": 18, "bold": true, "color": "#1565C0"}}
                ]}
            ]}}
        ]},
        {"body": [
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "text", "content": "Revenue Breakdown", "style": {"size": 16, "bold": true}},
                    {"type": "spacer", "height": "5mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "table", "table": {
                        "header": ["Division", "Q1 2026", "Q4 2025", "Change"],
                        "rows": [
                            ["Cloud Services", "$5,200,000", "$4,100,000", "+26.8%"],
                            ["Enterprise Software", "$3,800,000", "$3,500,000", "+8.6%"],
                            ["Consulting", "$2,100,000", "$1,900,000", "+10.5%"],
                            ["Support & Maintenance", "$1,400,000", "$1,350,000", "+3.7%"]
                        ],
                        "columnWidths": [35, 22, 22, 21],
                        "headerStyle": {"bold": true, "color": "white", "background": "#1A237E"},
                        "stripeColor": "#F5F5F5"
                    }},
                    {"type": "spacer", "height": "10mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "text", "content": "Expense Summary", "style": {"size": 16, "bold": true}},
                    {"type": "spacer", "height": "5mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 12, "elements": [
                    {"type": "table", "table": {
                        "header": ["Category", "Amount", "% of Revenue"],
                        "rows": [
                            ["Personnel", "$5,500,000", "44.0%"],
                            ["Infrastructure", "$1,800,000", "14.4%"],
                            ["Marketing", "$1,200,000", "9.6%"],
                            ["R&D", "$950,000", "7.6%"],
                            ["General & Admin", "$300,000", "2.4%"]
                        ],
                        "columnWidths": [40, 30, 30],
                        "headerStyle": {"bold": true, "color": "white", "background": "#1A237E"},
                        "stripeColor": "#F5F5F5"
                    }},
                    {"type": "spacer", "height": "10mm"}
                ]}
            ]}},
            {"row": {"cols": [
                {"span": 6, "elements": [
                    {"type": "text", "content": "Highlights", "style": {"bold": true, "color": "#2E7D32"}},
                    {"type": "spacer", "height": "2mm"},
                    {"type": "text", "content": "Cloud services revenue grew 26.8%, exceeding projections by 5%. New enterprise clients added: 47."}
                ]},
                {"span": 6, "elements": [
                    {"type": "text", "content": "Challenges", "style": {"bold": true, "color": "#C62828"}},
                    {"type": "spacer", "height": "2mm"},
                    {"type": "text", "content": "Infrastructure costs rose 12% due to scaling needs. Two major client renewals deferred to Q2."}
                ]}
            ]}}
        ]}
    ]
}

::


QR Code

Generate QR codes with configurable size and error correction levels.

::pdf-example{pdf="/pdfs/examples/27_qrcode.pdf"}

{
    "page": {"size": "A4", "margins": "20mm"},
    "metadata": {"title": "QR Code Examples", "author": "gpdf"},
    "body": [
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "QR Code Examples", "style": {"size": 18, "bold": true}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Basic QR code (URL):"},
                {"type": "spacer", "height": "2mm"},
                {"type": "qrcode", "qrcode": {"data": "https://gpdf.dev"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "QR codes with different sizes:"},
                {"type": "spacer", "height": "2mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 4, "elements": [
                {"type": "text", "content": "20mm", "style": {"size": 9, "color": "gray(0.4)"}},
                {"type": "qrcode", "qrcode": {"data": "https://gpdf.dev", "size": "20mm"}}
            ]},
            {"span": 4, "elements": [
                {"type": "text", "content": "30mm", "style": {"size": 9, "color": "gray(0.4)"}},
                {"type": "qrcode", "qrcode": {"data": "https://gpdf.dev", "size": "30mm"}}
            ]},
            {"span": 4, "elements": [
                {"type": "text", "content": "40mm", "style": {"size": 9, "color": "gray(0.4)"}},
                {"type": "qrcode", "qrcode": {"data": "https://gpdf.dev", "size": "40mm"}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "spacer": "5mm"}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Error correction levels (L / M / Q / H):"},
                {"type": "spacer", "height": "2mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 3, "elements": [
                {"type": "text", "content": "Level L", "style": {"size": 9}},
                {"type": "qrcode", "qrcode": {"data": "HELLO", "size": "25mm", "errorCorrection": "L"}}
            ]},
            {"span": 3, "elements": [
                {"type": "text", "content": "Level M", "style": {"size": 9}},
                {"type": "qrcode", "qrcode": {"data": "HELLO", "size": "25mm", "errorCorrection": "M"}}
            ]},
            {"span": 3, "elements": [
                {"type": "text", "content": "Level Q", "style": {"size": 9}},
                {"type": "qrcode", "qrcode": {"data": "HELLO", "size": "25mm", "errorCorrection": "Q"}}
            ]},
            {"span": 3, "elements": [
                {"type": "text", "content": "Level H", "style": {"size": 9}},
                {"type": "qrcode", "qrcode": {"data": "HELLO", "size": "25mm", "errorCorrection": "H"}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "spacer": "5mm"}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Japanese content:"},
                {"type": "spacer", "height": "2mm"},
                {"type": "qrcode", "qrcode": {"data": "こんにちは世界", "size": "30mm"}}
            ]}
        ]}}
    ]
}

::


Barcode

Code 128 barcodes with configurable width and height.

::pdf-example{pdf="/pdfs/examples/28_barcode.pdf"}

{
    "page": {"size": "A4", "margins": "20mm"},
    "metadata": {"title": "Barcode Examples", "author": "gpdf"},
    "body": [
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Barcode Examples", "style": {"size": 18, "bold": true}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Code 128 barcode:"},
                {"type": "spacer", "height": "2mm"},
                {"type": "barcode", "barcode": {"data": "INV-2026-0001"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "With display width (80mm):"},
                {"type": "spacer", "height": "2mm"},
                {"type": "barcode", "barcode": {"data": "PRODUCT-A-12345", "width": "80mm"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "With display height (10mm):"},
                {"type": "spacer", "height": "2mm"},
                {"type": "barcode", "barcode": {"data": "SMALL-BAR", "height": "10mm"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Numeric data (Code C optimization):"},
                {"type": "spacer", "height": "2mm"},
                {"type": "barcode", "barcode": {"data": "1234567890"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Barcodes in columns:"},
                {"type": "spacer", "height": "2mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 6, "elements": [
                {"type": "text", "content": "Item A", "style": {"size": 9}},
                {"type": "barcode", "barcode": {"data": "ITEM-A-001", "width": "60mm"}}
            ]},
            {"span": 6, "elements": [
                {"type": "text", "content": "Item B", "style": {"size": 9}},
                {"type": "barcode", "barcode": {"data": "ITEM-B-002", "width": "60mm"}}
            ]}
        ]}}
    ]
}

::


QR Code + Barcode Invoice

Professional invoice combining QR code for online payment and barcode for reference scanning.

::pdf-example{pdf="/pdfs/examples/29_qr_barcode_invoice.pdf"}

{
    "page": {"size": "A4", "margins": "20mm"},
    "metadata": {"title": "Invoice with QR/Barcode", "author": "ACME Corporation"},
    "body": [
        {"row": {"cols": [
            {"span": 8, "elements": [
                {"type": "text", "content": "ACME Corporation", "style": {"size": 22, "bold": true, "color": "#1A237E"}},
                {"type": "text", "content": "Invoice #INV-2026-042", "style": {"size": 12, "color": "gray(0.4)"}}
            ]},
            {"span": 4, "qrcode": {"data": "https://pay.acme.com/inv/2026-042", "size": "30mm", "errorCorrection": "H"}}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "spacer", "height": "3mm"},
                {"type": "line", "line": {"color": "#1A237E", "thickness": "2pt"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 6, "elements": [
                {"type": "text", "content": "Bill To:", "style": {"bold": true, "color": "gray(0.4)"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "text", "content": "Jane Doe", "style": {"bold": true}},
                {"type": "text", "content": "Tech Solutions Inc."},
                {"type": "text", "content": "456 Client Avenue"},
                {"type": "text", "content": "New York, NY 10001"}
            ]},
            {"span": 6, "elements": [
                {"type": "text", "content": "Date: March 1, 2026", "style": {"align": "right"}},
                {"type": "text", "content": "Due: March 31, 2026", "style": {"align": "right"}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "spacer": "8mm"}
        ]}},
        {"row": {"cols": [
            {"span": 12, "table": {
                "header": ["Description", "Qty", "Price", "Amount"],
                "rows": [
                    ["Web Development", "40 hrs", "$150.00", "$6,000.00"],
                    ["UI/UX Design", "20 hrs", "$120.00", "$2,400.00"],
                    ["QA Testing", "15 hrs", "$100.00", "$1,500.00"]
                ],
                "columnWidths": [40, 15, 20, 25],
                "headerStyle": {"bold": true, "color": "white", "background": "#1A237E"},
                "stripeColor": "#F5F5F5"
            }}
        ]}},
        {"row": {"cols": [
            {"span": 8},
            {"span": 4, "elements": [
                {"type": "spacer", "height": "3mm"},
                {"type": "text", "content": "Total:  $9,900.00", "style": {"align": "right", "bold": true, "size": 14}}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "spacer", "height": "10mm"},
                {"type": "line", "line": {"color": "gray(0.8)"}},
                {"type": "spacer", "height": "5mm"}
            ]}
        ]}},
        {"row": {"cols": [
            {"span": 12, "elements": [
                {"type": "text", "content": "Order Reference:", "style": {"size": 9, "color": "gray(0.4)"}},
                {"type": "spacer", "height": "2mm"},
                {"type": "barcode", "barcode": {"data": "INV-2026-042", "width": "100mm", "height": "15mm"}},
                {"type": "spacer", "height": "5mm"},
                {"type": "text", "content": "Scan QR code to pay online", "style": {"align": "center", "italic": true, "size": 9, "color": "gray(0.5)"}}
            ]}
        ]}}
    ]
}

::

Something unclear or missing on this page?