Skip to content

Images

Press renders images from URLs, asset libraries, or base64-encoded data. Images can be placed as standalone blocks, inline within text, or as full-page backgrounds.

Basic Usage

xml
<img src="https://example.com/images/photo.jpg" />

Default Sizing

By default with no width or height specified, an image fills the available width. If using all available width would make the image taller than the available height, it uses all available height instead, maintaining aspect ratio.

Explicit Sizing

Set width, height, or both:

xml
<img src="https://example.com/logo.png" width="120pt" />
<img src="https://example.com/banner.jpg" height="200pt" />
<img src="https://example.com/icon.png" width="48pt" height="48pt" />

Size Constraints

Use max-width and max-height to set upper bounds while preserving aspect ratio:

xml
<img src="https://example.com/photo.jpg" max-width="300pt" max-height="200pt" />

The image scales down to fit within the constraints without distortion.

Images from Asset Libraries

Define named images in <assets> and reference them by name:

xml
<assets>
  <images>
    <logo>https://example.com/images/company-logo.png</logo>
    <banner>https://example.com/images/header-banner.jpg</banner>
    <icon-phone>https://example.com/images/phone-icon.png</icon-phone>
  </images>
</assets>

Then use the name directly in src:

xml
<img src="logo" max-width="120pt" />
<img src="banner" width="100%" />

Images from Data

Bind image sources to data:

xml
<img src="{{ data.author-photo }}" max-height="150pt" />
<img show-if="data.graphic" src="{{ data.graphic }}" width="100%" />

Full-Page Background Images

Use absolute positioning to place an image behind all other content:

xml
<page>
  <img top="0" left="0" width="100%" height="100%"
       src="https://example.com/images/background.jpg" />
  <frame padding="2cm">
    <h1 font-color="white">Cover Page Title</h1>
  </frame>
</page>

The image is positioned at the top-left corner and stretched to fill the page. Content after the image is rendered over the top of the image.

Improving Text Over Images

Text-shadow

Adding a shadow of the opposite color to you heading can increase text readability against a background image:

xml
<page>
  <img top="0" left="0" width="100%" height="100%"
       src="https://example.com/images/landscape.jpg" />
  <frame padding="3cm" v-align="bottom">
    <h1 font-color="white" text-shadow="0.5pt black" font-size="36pt">Annual Report 2026</h1>
  </frame>
</page>

Semi-Transparent Overlays

Layer a coloured frame over a background image can also produce readable text:

xml
<page>
  <img top="0" left="0" width="100%" height="100%"
       src="https://example.com/images/landscape.jpg" />
  <frame top="0" left="0" width="100%" height="100%"
         background-color="rgba(0, 0, 0, 0.4)" />
  <frame padding="3cm" v-align="bottom">
    <h1 font-color="white" font-size="36pt">Annual Report 2026</h1>
  </frame>
</page>

Transparency

For images with transparent regions (PNGs), add transparency="true":

xml
<img src="logo" transparency="true" width="200pt" />

Alternately, you can set the background color of the image which will fill all transparent pixels.

Inline Images

Images inside a <p> or alongside text are rendered inline:

xml
<p>
  Contact us at
  <img src="icon-phone" width="12pt" height="12pt" /> +44 7700 123456
</p>

Example: A Property Card

xml
<frame break="never" border-weight="0.5pt" border-color="#e5e7eb" border-radius="6pt">
  <img src="{{ property.image }}" width="100%" max-height="200pt" />
  <frame padding="12pt">
    <frame font-size="14pt" font-style="bold">{{ property.address }}</frame>
    <frame font-size="11pt" font-color="#4b5563" space-after-desired="8pt">
      {{ property.bedrooms }} bed | {{ property.bathrooms }} bath | {{ property.sqft }} sq ft
    </frame>
    <frame font-size="16pt" font-style="bold" font-color="#059669">
      {{ property.price }}
    </frame>
  </frame>
</frame>