Skip to content

Bash scripts to create latin Vintage Apothecary Labels (actually any labels you like) from JSON as SVG via mustache templates for printing as SVG and then PDF for printing.

License

Notifications You must be signed in to change notification settings

katzlbt/VintageApothecaryLabels

Repository files navigation

Vintage Apothecary Labels

Very simple bash scripts with as few as possible dependencies to create Vintage Apothecary Labels (or actually any other labels, too) as JSON compiled to SVG using mustache templates for printing the labels. If you also install ImageMagick the second script can combine the SVGs into a PDF. Currently included labels sets:

  • Latin kitchen spices

Requires mustache (https://mustache.github.io/) template command. Optionally have ImageMagick ready to create a pdf.

bottle

USAGE

Create a JSON file in ./jsons containing: {"label":"Folia Lauri", "sublabel":"folia integra", "font": 1} or a two-line version {"label1":"Schinus", "label2":"Terebinthifolia", "sublabel":"grana integra", "font": 1}. The Filename will be used to create the SVG from the template ./ApothecaryLabel.mustache The font can be globally configured in the script and is replaced with sed (which is a hack that needs the space, or adjusted individually). Simply run ./make-labels.sh to create the SVGs and drop them e.g. on a Mac into Pages.app to scale and print them. A Webbrowser can display them too. If you have ImageMagick, make-pdf.sh can create a PDF sheet.

make-labels.sh

Creates SVG files for each JSON input file using a mustache template.

-d directory ... change input directory from default jsons
-o directory ... change output directory from default svgs
-t file ... change mustache template from default ApothecaryLabel.mustache

make-pdf.sh

Puts SVGs into a PDF file for printing. Repeat the same name with -f to add identical labels. The resulting PDF needs to be scaled to fit a printer page. I cannot get montage to do this correctly. MacOS auto-scales the PDF to fit the page when printing.

-g specifies ... the geometry e.g. 2x 3x 4x for how many columns of labels. This determines the resulting size.
-d directory ... changes the input directory from ./svgs to your choice
-f file1,file2,... optionally manually select files to (re)print
-o output.png ... created inside -d (default 2print.pdf)

3x8 fits 24 labels perfectly (6x3 cm) per page (adding pages if needed)
2x5 fits 10 labels (8.5x4.25 cm) per page
2x6 fits 12 labels per page
4x  makes rather small labels

You can change the extension to PNG if you want to use Word/Pages etc. for scaling before printing.

split-merge-json.sh

Optional: This script can merge (-m) all json files of a directory into a single file for translation/processing with an AI and split (-s) it again into single files for template processing. Requires jq installed.

Hints

Get PostIt full-page paper and print the labels onto it. Use a paper cutter to split them. They can easily be changed later. Coat the labels using a clear paint spray (e.g. Nigrin Klarlack Spray) to fixate the toner and make them washable.

INSTALLATION

Download a precompiled binary mustache release (easiest) and put it on your path: https://github.com/cbroglie/mustache/releases

ImageMagick install instructions: see make-pdf.sh comment by Gemini.

Download and install the Copperplate font or use a different one.

HELP

If you want to help/improve, make a new label design, please make a new mustache template as pull-request. make-labels.sh -t NewDesign.mustache should do the trick. Be aware that ImageMagick has some rendering issues with SVGs.

jq

 # merge all jsons for jq processing
 ./split-merge-json.sh -m -d jsons/latin-spices/
 
 # extract german cheat sheet
 jq -c '.[] | select(.aka) | .aka + ", " + .label + .label1 + " " + .label2' jsons-merged.nogit.json | sed -e "s/\"//g" | (while IFS=, read -r col1 col2 col3 ; do echo ${col2}"," $col3 ; done) | sort

 # extract german cheat sheet
 jq -c '.[] | select(.aka) | .aka + ", " + .label + .label1 + " " + .label2' jsons-merged.nogit.json | sed -e "s/\"//g" | (while IFS=, read -r col1 col2 col3 ; do echo ${col3}"," $col2 ; done) | sort

About

Bash scripts to create latin Vintage Apothecary Labels (actually any labels you like) from JSON as SVG via mustache templates for printing as SVG and then PDF for printing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published