pace-running / pace3

used for "lauf gegen rechts 2023"
2 stars 1 forks source link

VIEW STARTING NUMBER (DOWNLOAD) #33

Open prodb opened 2 years ago

prodb commented 2 years ago

As an event attendee when I have paid and want to run I want to download the startnumber as pdf So that I can pin it to my shirt and post it on insta

Business Context: For the on-site event, we print the startnumbers, but for people participating remotely, they need to download the startnumber (bib) themselves and print it. We usually have a nice background from the St. Pauli stadium and the number in big letters. For a start, it would be sufficient if the participants could download a PDF that only shows their Number, First name and Team-Name. They should find this PDF on their personal status page. The one that also shows the payment status.

This is how it was done in the old application: https://github.com/pace-running/pace2/blob/fdcf023eed2972bac0c05d4bb1756ce26d40818f/api/controllers/startNumberController.js#L74 Again: This is just a js example for inspiration. I would think this will be implemented in the backend

An example Bib from last year: 4408.pdf

qutax commented 1 year ago

There are a few PDF libraries for Rust. I made a spiked three options (pdf-writer, lopdf, and printpdf (which uses lopdf internally)) and finally went with implementing a proof of concept using pdf-writer (and a bit of lopdf).

Short comparison: Library Pros Cons
pdf-writer ok documentation / examples Low-level
lodpf example usage via printpdf Low-level
printpdf High-level No PNGs, no SVGs => no alpha channel; no idea how to compress images

An example of the generated PDF can be found here.