Images
Embed images directly in your PDF from URLs or base64 data.
Syntax
markdown

{width=200 align=center}
{h=150 align=right}Inline vs Block Images
Images can be rendered either as distinct blocks or inline with text.
- Block Images: If an image is the only element in a paragraph (i.e. on its own line), it will render as a standalone block. Block images support the
alignattribute (left,center,right). - Inline Images: If an image is mixed directly with text, the library automatically renders it inline, anchoring it to the text baseline so it flows naturally within the sentence. Inline images ignore the
alignattribute (since they follow the text flow) but fully supportwidthandheightadjustments.
markdown
<!-- Block image -->
{align=center}
<!-- Inline image flow -->
Here is an inline LaTeX equation  placed right inside the text!Custom Attributes
Add an attribute block {...} immediately after the image syntax to control sizing and alignment:
| Attribute | Alias | Type | Description |
|---|---|---|---|
width | w | number | Image width in pixels |
height | h | number | Image height in pixels |
align | — | string | 'left' | 'center' | 'right' |
Sizing Rules
- No attributes → renders at intrinsic (original) size, scaled down if exceeds page width
- Width only → height auto-calculated from aspect ratio
- Height only → width auto-calculated from aspect ratio
- Both → exact dimensions (may distort if aspect ratio differs)
- Images that exceed
page.maxContentWidthare always scaled down proportionally
Global Default Alignment
ts
const options = {
// ...other options
image: {
defaultAlign: 'center', // 'left' (default) | 'center' | 'right'
},
}Individual images can override this with the align attribute.
Relevant Options
| Option | Effect |
|---|---|
image.defaultAlign | Default alignment for all images |
page.maxContentWidth | Maximum width — images scale down to fit |
Examples
markdown
<!-- Default size and alignment -->

<!-- Fixed width, auto height, centered -->
{width=150 align=center}
<!-- Fixed height, auto width, right-aligned -->
{h=80 align=right}
<!-- Both dimensions specified -->
{width=100 height=60}Try It
Interactive
Try this in the Playground — paste the markdown above and click Generate PDF.