unchained icon indicating copy to clipboard operation
unchained copied to clipboard

Default pdf templates

Open Mikearaya opened this issue 1 month ago • 2 comments

Mikearaya avatar Nov 11 '25 12:11 Mikearaya

@pozylon what do you think? Default order pdf svg template Importable order PDF that uses react-pdf

and importable google wallet pass

All imprts are with optional dependencies

Mikearaya avatar Nov 14 '25 13:11 Mikearaya

I haven't tested the apple wallet pass, please do on your end if you can

Mikearaya avatar Dec 05 '25 11:12 Mikearaya

It's hard to test this functionality as the ticketing example does currently not use the new functions, i'd expect something like this in the ticketing example:

setupTicketing(platform.unchainedAPI as TicketingAPI, {
    renderOrderPDF: createPDFTicketRenderer((orderId: string, context): DefaultTicketProperties => {
      const order = context.modules.orders.getOrderById(orderId);
      const tokens = await modules.warehousing.findTokens({
        "meta.orderId": orderId,
      });
      return {
        title: "Event XY",
        logoUrl: "https://example.com/logo.png",
        orderNumber: orde.orderNumber
        tickets: tokens.map(token => ({
          title: `VIP Ticket: ${token.serialNumber}`,
          qrCode: token.id,
          stripText: `Place: blabla, come early or get the fuck out of here`,
        })),
      }
    }),
  });

renderOrderPDF should be typed to something like this:

createPDFTicketRenderer: (orderId, context) => { contentType: string; blob: ArrayBuffer }

Goal is to give users of the ticketing module a sane default to at least generate usable tickets. If the document generated is unusable it doesn't make sense to give helpers. It should actually print general tickets like in the theater or gastro projects but with a much more generalized design.

User can do:

  1. use the default pdf ticket renderer (no pdf but generateOrderSVG renderer, this should generate svg tickets that are completely unbranded but look like tickets and could be used in a mvp)
  2. configure the ticketing renderer like above to create at least "logo" branded customized tickets
  3. completely re-implement the renderer and take over binary creation

pozylon avatar Dec 18 '25 18:12 pozylon