Code patterns
The tutorial shows you what the API can do. These pages are about how to structure your own code so that real documents (invoices with dozens of line items, reports assembled from a database, branded templates reused across a team), stay readable and maintainable.
None of these patterns require new framework features. They are conventions for organizing plain C# around the document model: how to factor reusable pieces, where to put helpers, and how to drive structure from data.
- Components & reuse: factor a repeated piece of a document into a reusable unit. The Rivoli PDF answer to “how do I make a component?”
- Document structure & composition: organize a large document into composable sections instead of one giant method.
- Local helper methods: small private methods that keep a single document method readable.
- Styling via extension methods: package styling and content shortcuts as fluent extension methods.
- Dynamic & data-driven content: generate content from collections, conditions, and loops.
- Working with the builder: when to use
DocumentBuilder, the fluent helpers, or direct POCO construction.
© 2026 Rivoli AI