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

Preview

Hello World Text Styling Layout
Hello Text Layout
Shapes & Drawing Images Links
Shapes Images Links
Multi-page Report Professional Invoice
Report Invoice

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


Table of contents