pdf Flutter Package (dart_pdf / printing)
Third Party Library Integration by David PHAM-VAN (open source)
Description
The pdf Flutter package generates PDF documents client-side and via Supabase Edge Functions for Bufdir export bundles, activity report exports, and driver declaration documents. Generates structured, printable PDFs matching official report formats required by Bufdir and Norges Blindeforbund's formaliserte rapportstruktur (formalised report structure), including charts, tables, and organisation branding.
Detailed Analysis
The pdf package (Apache 2.0 licence) enables the organisation to produce Bufdir-compliant export bundles, activity report exports, and driver declaration documents that match the formalised report structures required by Bufdir and Norges Blindeforbund β a non-negotiable compliance and funding requirement. Generating these documents client-side and via Supabase Edge Functions eliminates dependency on expensive third-party PDF-as-a-service vendors, keeping marginal costs limited to Supabase Storage for cloud-stored PDFs. Driver declaration PDFs support optional password protection, and all documents containing personal data are stored in private Supabase buckets with temporary device files deleted after upload or sharing, reducing data breach exposure. The server-side Edge Function fallback ensures low-memory devices can still produce compliant reports, maintaining accessibility across the diverse device landscape of the membership.
PDF generation has two delivery paths: client-side (pdf ^3.10.0 + printing ^5.12.0) and server-side via Supabase Edge Functions for low-memory device fallback. Four components are involved: 141-pdf-generation-service, 415-bufdir-pdf-generator, 148-file-download-handler, and 406-bufdir-export-orchestrator. The Bufdir-compliant PDF template development is the highest-effort item and should be scoped as a dedicated task, as it requires close alignment with official report format specifications including charts, tables, and organisation branding. Performance target is < 5 seconds for a full annual Bufdir report β this must be load-tested with realistic data volumes.
The CSV export fallback must be implemented in parallel to ensure export capability is never fully blocked. Font embedding for Norwegian character support (ΓΈ, Γ¦, Γ₯) is a required configuration item that must be validated early. No external API keys are required, but Supabase Storage bucket policies for generated PDFs must be configured before integration testing.
The pdf package (^3.10.0) generates PDFs entirely in Dart, with the printing package (^5.12.0) providing system-level share and print functionality. Page size, margins, font embedding (required for Norwegian characters), and organisation logo assets are configured per report type. Password protection is available for driver declaration documents. Generated PDFs are written to a temporary directory and deleted after successful upload to Supabase Storage or share completion to prevent PII leakage on-device.
Error handling: insufficient storage shows an actionable message; generation failures fall back to CSV export; for low-memory devices, generation is offloaded to a Supabase Edge Function. The 415-bufdir-pdf-generator component handles Bufdir-specific template logic including embedded charts and structured tables. Monitoring tracks generation success rate and average generation time. No network calls are made by the pdf package itself β it is a pure Dart PDF construction library with outbound data flow only when the generated file is uploaded to Supabase Storage.
Using Components (4)
Dependencies (3)
Authentication
| Type | None |
Configuration
Error Handling
Monitoring
Performance
| Latency | < 5s for full Bufdir annual report PDF generation |
| Availability | Device-local generation β no network dependency |
Cost Implications
| Pricing Model | Free open-source (Apache 2.0 licence) |