facture-pdf

Generates family tuition invoice PDFs in Laravel with hand-written PDF 1.4 output.

Updated May 5, 2025
One-click install
npx skills add https://github.com/sebauvray/toollab-api --skill facture-pdf-sebauvray
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: facture-pdf
Source: https://github.com/sebauvray/toollab-api/tree/main/.claude/skills/facture-pdf
Command: npx skills add https://github.com/sebauvray/toollab-api --skill facture-pdf-sebauvray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Schools using the Toollab platform need legally compliant tuition invoices for families, including correct French VAT regime mentions (CGI articles), deterministic invoice numbering, and paid/unpaid status display, without adding any Composer PDF dependency. ## Core Features & Use Cases - Invoice endpoint: GET /api/families/{family}/paiements/facture returns a downloadable PDF reflecting the current payment state, accessible to both staff and family members via callerCanAccessFamily. - Hand-written PDF 1.4 service: FacturePdfService builds a six-object A4 PDF with exact xref offsets, WinAnsi-encoded Helvetica text, and width-table-based right/center alignment, with zero external dependencies. - VAT regime handling: Prints the correct CGI mention (261 7-1°, 261 4-4°, 293 B) or an HT/TVA 20%/TTC breakdown for assujetti schools, driven by schools.vat_mode. - Use Case: A parent opens the family payment page, clicks the Facture PDF button, and downloads an invoice showing total, amount paid, exemptions, and remaining balance with the correct fiscal footer. ## Quick Start Ask the AI to modify the invoice layout or VAT mentions in FacturePdfService, then regenerate and visually open the PDF via the curl command in the skill to verify the xref offsets and alignment.

Frequently Asked Questions about facture-pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a PDF invoice in Laravel without external libraries?▼

Write the PDF 1.4 structure manually: build Catalog, Pages, Page, Font, and Contents objects, compute exact byte offsets for the xref table, and stream text with native Helvetica fonts. FacturePdfService in this project follows that approach with zero Composer dependencies.

How to handle French VAT mentions on school tuition invoices?▼

Map the school's vat_mode to the correct CGI mention: article 261 7-1° for associations, 261 4-4° for regulated teaching, 293 B for franchise, and an HT/TVA 20%/TTC breakdown for assujetti. Prices are stored TTC and HT is retro-calculated by dividing by 1.2.

Why does my generated PDF show misaligned right-aligned text?▼

Right and center alignment depends on a Helvetica width table measured in thousandths of a point. Any glyph missing from the table falls back to 556 units, silently shifting alignment, so extend the width constant when adding special characters.

Why is my hand-written PDF corrupted or unreadable?▼

Common causes are locale-dependent number formatting and wrong xref offsets. Always use sprintf('%.2F') instead of %f so decimals never use commas, and open the generated file in a real viewer since offset errors are invisible in code review.

Can family members download their own invoice through the API?▼

Yes, the endpoint uses the same callerCanAccessFamily gate as the family detail page, so both staff and family members can download it. The frontend button is intentionally not restricted to director or admin roles.