Skip to main content

Coach E-Ticket

The e-ticket an intercity coach company emails after booking, for the passenger to print at home or show on a phone. The top panel is what the driver scans; the rest is what the passenger reads before setting off.

  • The panel above the fold. A QR code to the ticket's own page, the date, both stops with their times and bays, the passenger, and the seat on an orange block with its service and bay.
  • A timeline of every stop. One row per call, drawn from the booking's list of stops: a filled dot where the journey starts and ends, an open ring at each call, and the line joining them.
  • Luggage and boarding rules in two columns, then the fare paid with its booking fee and card.
  • A luggage label to cut out, with the destination, the passenger and a Code 128 the driver scans when loading.
  • Signed. The ticket carries an invisible PAdES signature that certifies it: an altered ticket no longer verifies.
  • Archival and accessible. It claims PDF/A-2a and PDF/UA-1.

Features used: PDF/A-2a, PDF/UA-1 conformance, columns, tables, lists, rules, SVG, barcodes (code128, qrcode), a digital signature, data binding

How it's built​

The timeline is a table with one templated row, drawn once per entry of stops. Its second cell is a small svg whose line and dot styles are chosen by the stop's kind:

{
"table": {
"role": "presentation", "widths": [5, 3, 22, 30], "source": "$data.stops",
"rows": [[
{ "td": "$item.time", "style": "ceStopTime" },
{ "svg": { "title": "$item.role", "viewBox": [24, 30], "width": 24, "children": [
{ "line": { "x1": 12, "y1": 0, "x2": 12, "y2": 15, "style": "ceUp-$item.kind" } },
{ "line": { "x1": 12, "y1": 15, "x2": 12, "y2": 30, "style": "ceDown-$item.kind" } },
{ "circle": { "cx": 12, "cy": 15, "r": 4.6, "style": "ceDot-$item.kind" } } ] }, "style": "ceStopMark" },
{ "td": "$item.name", "style": "ceStopName" },
{ "td": "$item.note", "style": "ceStopNote" }
]]
}
}

Each stop names its kind - origin, call or destination - and the styles do the rest: the origin draws no line above its dot, the destination none below.

// coach-e-ticket.data.json, in part
{
"stops": [
{ "time": "07:40", "name": "Verdania City", "note": "Central Coach Station, Bay 14", "kind": "origin", "role": "Departs" },
{ "time": "08:15", "name": "Lakeside Park & Ride", "note": "Stop 2 · pick-up only", "kind": "call", "role": "Calls at" }
]
}