diff --git a/src/admin/station/print.rs b/src/admin/station/print.rs index 3b06a5a..bd1d1e8 100644 --- a/src/admin/station/print.rs +++ b/src/admin/station/print.rs @@ -21,6 +21,14 @@ pub(crate) async fn station_pdf(stations: Vec) -> Vec { #let card_width = 105mm // A4 width (210mm) divided by 2 #let card_height = 74.25mm // A4 height (297mm) divided by 4 +#let trimstring(text, max-length) = { + if text.len() <= max-length { + text + } else { + text.slice(0, max-length - 3) + "..." + } +} + // Custom function to create a card with title and QR code for a URL #let create_url_card(title, url) = { box( @@ -33,9 +41,9 @@ pub(crate) async fn station_pdf(stations: Vec) -> Vec { ), [ #align(center + horizon)[ - #text(weight: "bold", size: 14pt)[Station #title] + #text(weight: "bold", size: 14pt)[Station #trimstring(title, 100)] #qr-code(url, width: 4cm) - #text(size: 8pt)[#link(url)] + #text(size: 11pt)[#link(url)] ] ] )