Producing files.
WHAT APPLICATIONS COMMONLY GENERATE
Invoices Receipts Statements Reports Data exports
WHAT TO USE FOR DOCUMENTS
A library that renders markup to a document, which suits existing templates well.
WHY THAT APPROACH
You design in familiar markup and reuse your styling.
WHAT TO BE CAREFUL WITH
Memory, on large documents Time, on anything slow External images, which may not load
WHAT TO DO ABOUT SLOW GENERATION
Queue it, and notify when ready.
WHY
Generating during a request risks timeouts and makes the user wait.
WHAT TO USE FOR TABULAR EXPORTS
CSV, for simplicity and reliability A spreadsheet library, where formatting is required
WHAT TO BE CAREFUL WITH IN CSV
Values beginning with characters a spreadsheet interprets as formulas.
WHAT TO DO ABOUT THAT
Prefix or quote them appropriately.
WHAT TO INCLUDE IN ANY GENERATED DOCUMENT
The period covered, when generated, and a reference.
WHERE TO STORE THEM
Outside the public directory, served through a route that checks entitlement.