Basics
Hello World, text styling, and color system examples
Hello World
The simplest possible PDF — a single page with bold text.
::pdf-example{pdf="/pdfs/examples/01_hello_world.pdf"}
{
"page": {"size": "A4", "margins": "20mm"},
"body": [
{"row": {"cols": [
{"span": 12, "text": "Hello, World!", "style": {"size": 24, "bold": true}}
]}}
]
}
::
Text Styling
Demonstrates font sizes, bold/italic, text colors, background colors, and text alignment.
::pdf-example{pdf="/pdfs/examples/02_text_styling.pdf"}
{
"page": {"size": "A4", "margins": "20mm"},
"body": [
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Text Styling Examples", "style": {"size": 20, "bold": true}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Font Size 8pt", "style": {"size": 8}},
{"type": "text", "content": "Font Size 12pt (default)", "style": {"size": 12}},
{"type": "text", "content": "Font Size 18pt", "style": {"size": 18}},
{"type": "text", "content": "Font Size 24pt", "style": {"size": 24}},
{"type": "text", "content": "Font Size 36pt", "style": {"size": 36}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Normal text"},
{"type": "text", "content": "Bold text", "style": {"bold": true}},
{"type": "text", "content": "Italic text", "style": {"italic": true}},
{"type": "text", "content": "Bold + Italic text", "style": {"bold": true, "italic": true}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Red text", "style": {"color": "red"}},
{"type": "text", "content": "Green text", "style": {"color": "green"}},
{"type": "text", "content": "Blue text", "style": {"color": "blue"}},
{"type": "text", "content": "Custom color (orange)", "style": {"color": "rgb(1.0, 0.5, 0.0)"}},
{"type": "text", "content": "Hex color (#336699)", "style": {"color": "#336699"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Yellow background", "style": {"background": "yellow"}},
{"type": "text", "content": "Cyan background", "style": {"background": "cyan"}},
{"type": "text", "content": "White text on dark background", "style": {"color": "white", "background": "#333333"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Left aligned (default)", "style": {"align": "left"}},
{"type": "text", "content": "Center aligned", "style": {"align": "center"}},
{"type": "text", "content": "Right aligned", "style": {"align": "right"}}
]}
]}}
]
}
::
Colors
Comprehensive color system with predefined colors, RGB, hex, grayscale, and background swatches.
::pdf-example{pdf="/pdfs/examples/17_colors.pdf"}
{
"page": {"size": "A4", "margins": "20mm"},
"body": [
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Color System Examples", "style": {"size": 18, "bold": true}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Predefined Colors:", "style": {"bold": true}},
{"type": "text", "content": "Red", "style": {"color": "red"}},
{"type": "text", "content": "Green", "style": {"color": "green"}},
{"type": "text", "content": "Blue", "style": {"color": "blue"}},
{"type": "text", "content": "Yellow", "style": {"color": "yellow"}},
{"type": "text", "content": "Cyan", "style": {"color": "cyan"}},
{"type": "text", "content": "Magenta", "style": {"color": "magenta"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "RGB Colors (float):", "style": {"bold": true}},
{"type": "text", "content": "RGB(1.0, 0.5, 0.0) - Orange", "style": {"color": "rgb(1.0, 0.5, 0.0)"}},
{"type": "text", "content": "RGB(0.5, 0.0, 0.5) - Purple", "style": {"color": "rgb(0.5, 0.0, 0.5)"}},
{"type": "text", "content": "RGB(0.0, 0.5, 0.5) - Teal", "style": {"color": "rgb(0.0, 0.5, 0.5)"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Hex Colors:", "style": {"bold": true}},
{"type": "text", "content": "#FF6B6B - Coral", "style": {"color": "#FF6B6B"}},
{"type": "text", "content": "#4ECDC4 - Turquoise", "style": {"color": "#4ECDC4"}},
{"type": "text", "content": "#45B7D1 - Sky Blue", "style": {"color": "#45B7D1"}},
{"type": "text", "content": "#96CEB4 - Sage", "style": {"color": "#96CEB4"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "elements": [
{"type": "text", "content": "Grayscale:", "style": {"bold": true}},
{"type": "text", "content": "Gray(0.0) - Black", "style": {"color": "gray(0.0)"}},
{"type": "text", "content": "Gray(0.3) - Dark gray", "style": {"color": "gray(0.3)"}},
{"type": "text", "content": "Gray(0.5) - Medium gray", "style": {"color": "gray(0.5)"}},
{"type": "text", "content": "Gray(0.7) - Light gray", "style": {"color": "gray(0.7)"}},
{"type": "spacer", "height": "5mm"}
]}
]}},
{"row": {"cols": [
{"span": 12, "text": "Background Color Swatches:", "style": {"bold": true}}
]}},
{"row": {"cols": [
{"span": 3, "text": " Red ", "style": {"color": "white", "background": "red"}},
{"span": 3, "text": " Green ", "style": {"color": "white", "background": "green"}},
{"span": 3, "text": " Blue ", "style": {"color": "white", "background": "blue"}},
{"span": 3, "text": " Yellow ", "style": {"background": "yellow"}}
]}}
]
}
::
Something unclear or missing on this page?