Appearance
QR Codes
Press can generate QR codes directly in documents. They're commonly used for business cards, event badges, and documents that need to link to online resources.
Basic Usage
xml
<qr-code data="https://example.com/contact/jane-doe" />The data attribute holds the content to encode -- typically a URL, but it can be any text.
Sizing
Control the size with width and height:
xml
<qr-code data="https://example.com" width="80pt" height="80pt" />Data-Driven QR Codes
Bind the QR code content to data:
xml
<qr-code data="{{ data.profile-url }}" width="60pt" height="60pt" />Conditional QR Codes
Show a QR code only when a URL is provided:
xml
<qr-code show-if="data.website" data="{{ data.website }}"
width="60pt" height="60pt" />Example: A Business Card
xml
<press>
<document width="8.5cm" height="5.5cm" font-color="white" background-color="black">
<repeat data="data.contacts" item="person">
<page padding="0.5cm">
<frame direction="row" height="100%" v-align="center">
<frame width="fill" v-align="center">
<frame font-size="12pt" font-style="bold">{{ person.name }}</frame>
<frame font-size="9pt" font-color="#9EA7F0">{{ person.title }}</frame>
<frame height="8pt" />
<frame font-size="8pt" line-height="1.6">
{{ person.email }}<br />
{{ person.phone }}
</frame>
</frame>
<frame show-if="person.url" width="fill" h-align="right" v-align="center">
<qr-code data="{{ person.url }}" border-radius="0.2cm" padding="0.2cm" background-color="white" />
</frame>
</frame>
</page>
</repeat>
</document>
<data type="json">
{
"contacts": [
{
"name": "Jane Ashworth",
"title": "Head of Operations",
"email": "j.ashworth@example.com",
"phone": "+44 7700 123456",
"url": "https://example.com/team/jane-ashworth"
},
{
"name": "Marcus Reed",
"title": "Lead Developer",
"email": "m.reed@example.com",
"phone": "+44 7700 654321",
"url": "https://example.com/team/marcus-reed"
}
]
}
</data>
</press>This generates one business card per contact, each with a QR code linking to their profile page.