Examples

Complete code examples demonstrating compose2pdf features. All examples are runnable – see Running Examples to generate PDFs locally.


# Example Features demonstrated
01 Hello World Basic renderToPdf, text, layout
02 Page Configuration Page presets, margins, landscape, custom sizes
03 Text Styling Font weights, styles, colors, decorations, alignment
04 Layout Basics Column, Row, Box, weights, arrangement, padding
05 Shapes and Drawing Backgrounds, borders, clips, Canvas, rounded corners
06 Images in PDF Bitmap embedding, sizing, circle clips
07 Links in PDF Text links, button links, inline links, email links
08 Multi-page Report Multi-page, shared headers/footers, tables, page numbers
09 Vector vs Raster Side-by-side comparison of rendering modes
10 Professional Invoice Complete real-world document with all features
11 Auto-Pagination Content flowing across pages automatically
12 PaginatedColumn Page-break-aware column, children kept together
13 Header & Footer Per-page header/footer slots with page numbers
14 Custom Fonts Font(resource) families, bundled Inter, generic families — all embedded automatically

Preview

Hello World Text Styling Layout
Hello Text Layout
Shapes & Drawing Images Links
Shapes Images Links
Multi-page Report Professional Invoice Custom Fonts
Report Invoice Custom Fonts
Auto-Pagination PaginatedColumn Header & Footer
Auto-Pagination PaginatedColumn Header & Footer

Download PDFs

Example PDF
Hello World 01-hello.pdf
Page Configuration (A4) 02-a4-default.pdf
Page Configuration (Letter) 02-letter-with-margins.pdf
Page Configuration (A3 Landscape) 02-a3-landscape.pdf
Text Styling 03-text-styling.pdf
Layout Basics 04-layout-basics.pdf
Shapes & Drawing 05-shapes-and-drawing.pdf
Images 06-images.pdf
Links 07-links.pdf
Multi-page Report 08-multi-page.pdf
Vector Mode 09-vector-mode.pdf
Raster Mode 09-raster-mode.pdf
Professional Invoice 10-invoice.pdf
Auto-Pagination 11-auto-pagination.pdf
PaginatedColumn 12-paginated-column.pdf
Header & Footer 13-header-footer.pdf
Custom Fonts 14-custom-fonts.pdf


Table of contents