Created
April 25, 2026 19:10
-
-
Save tehlers/8ca02007d3489053cad47d796a2a8b3d to your computer and use it in GitHub Desktop.
Generates a PDF with Archive Serial Number (ASN) labels to print on Avery L4732REV (16x5 labels, A4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * ASN labels to be used with Paperless-ngx | |
| * | |
| * Purpose: Generates a PDF with Archive Serial Number (ASN) labels to print on | |
| * Avery L4732REV (16x5 labels, A4). | |
| * | |
| * Libraries: | |
| * - @preview/rustycure:0.2.0 -> Renders QR codes. | |
| * | |
| * Usage: | |
| * Compile via CLI and pass the starting number: | |
| * `typst compile --input start=1 your_file.typ` | |
| */ | |
| #import "@preview/rustycure:0.2.0": qr-code | |
| #let start = int(sys.inputs.at("start", default: "1")) | |
| #let label(archive_number) = box(width: 100%, height: 100%, inset: 1mm, stroke: none)[ | |
| #let asn = "ASN" + numbering("00001", archive_number) | |
| #set align(center + horizon) | |
| #stack( | |
| dir: ltr, | |
| spacing: 1fr, | |
| qr-code(asn, width: 55%, alt: asn), | |
| { | |
| set text(font: "DejaVu Sans Mono", size: 8pt) | |
| asn | |
| } | |
| ) | |
| ] | |
| #set page( | |
| paper: "a4", | |
| margin: ( | |
| top: 14.5mm, | |
| // top: 13.5mm, (measured, but 14.5mm works better with my printer) | |
| bottom: 12mm, | |
| left: 11mm, | |
| right: 11mm, | |
| ), | |
| ) | |
| #grid( | |
| columns: (35.6mm, 35.6mm, 35.6mm, 35.6mm, 35.6mm), | |
| rows: (16.9mm), | |
| column-gutter: 2.5mm, | |
| row-gutter: 0mm, | |
| ..range(start,start + 80).map(label) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment