UBUC Labels
Introduction
UBUC labels its equipment with distinctive standardised labels. This document explains the labelling system and describes how PDF files may be created containing replacement labels.
Overview
The labels are used in conjunction with UBUC's operations manual. The manual consists of two documents.
• The manual of permanent information http://ubuc.org/maintenance/xml/UBUCManual.xml
• The log of changing information http://ubuc.org/maintenance/xml/log.xml
The labels are intended to be permanent attachments and so the information that they present comes from the manual only. The information that is required from the manual is the 5 letter id of the item to be labelled and optionally its description. The 5 letter id is the key piece of information used to construct the url of the items web page as follows
http://ubuc.org/maintenance/Manual.php?id=<5 letter id>
So for instance Regulator 01 has an id of rg001 and so its page is:
http://ubuc.org/maintenance/Manual.php?id=rg001
It isn't just our equipment that has an id and therefore has web page and may have a label. We have:
• Parts e.g. SPG Swivel O-ring
• Tools e.g. Spark Jump Tester
• Consumables e.g. Fogging Spray
Also referred to in the manual and hence assigned an ID – though in these cases the id does not represent a single item but a type of item. This allows us to track where to purchase these necessities and also documents what they are used for.
UBUC's equipment comes in different shapes and sizes and so two sizes of labels are currently in use. A large label and a small label:
Both labels contain a QR code. Smart phones are becoming
more common and many free apps exist like QR Droid that enable the smart phone
to read the QR code and open the web page for that item being viewed. These
apps are also available for PCs and tablets. The intention is to make it as
easy as possible to access each items log from its label to encourage members
to view and contribute to that log.
Creating Labels
Thanks to the database, there is a semi-automated way of making the labels. The result of which gives you a A4 sized pdf file with both large and small labels on it that you can give to your printer of choice. I am writing this as essentially a dummies guide, but knowledge of a tag based programming language/file structure such as HTML or XML will be very useful. To do this, you need the following downloaded on your computer:
- Apache FOP 2.0: https://xmlgraphics.apache.org/fop/2.0/
- The latest version of Java for your system
- UBUCManual.xml: http://ubuc.org/maintenance/xml/
- PDFLabels.xslt: http://ubuc.org/maintenance/xslt/
When you download Apache FOP, make sure that there are no spaces in the file path as it will give you an error.
I am writing this guide using Windows, hence if you are using Mac or Linux some stages will be different. Most of the time, I will warn you if I believe that it will be different on a different OS.
Firstly, you need to edit our Manual.xml file. To edit this file, you need an XML editor of some sort. Visual Basic includes an XML editor, as do most programming IDEs, but there are also online editors if you don’t know what those are.
In the manual.xml file, scroll down until you find the tag saying
<collection name="Reglators">. Note that there is also a
similar collection for cylinders, BCDs, and pretty much all other equipment in
this area. Boat related equipment, such as radios and boat poles, are found
earlier in the document. If you look in the regulators collection you will find
all the regulators the club owns represented as <item> tags.
Delete the item tags for all regulators that you do not want stickers for.
Then, look for other item tags representing the items you want stickers. They
will be found in the relevant collections. Copy and paste them so that they are
in between <itemgroup id="colregs" name="Regulators">
and
the subsequent </itemgroup>. Delete
each item from its original position after you have copied and pasted it. Save
this new file as UBUCManualEdit.xml
to not get confused with the original file.
Now go to https://www.freeformatter.com/xsl-transformer.html, or any
other XSL transformer of your choice. For the XML input, browse for the UBUCManualEdit.xml
file, and for the XSL input browse for the PDFLabels.xslt
file. Press the Transform XML button, and then copy the transformed XML to your
clipboard using the appropriate button.
Open your text editor (Notepad, etc) of choice, and create a new
file. Paste into this file so you get a bunch of XML gibberish. Now save inside
the fop-2.0 folder, calling it output.fo.
Make sure that you specify the .fo file type, or this
will not work. In Notepad you can do this by changing the drop down of “Save as
type” to “All files”, then just typing output.fo in the file name box. While
you’re here, copy the fop-2.0 folder’s file path. Also, in the FOP folder run
the fop.bat if on Windows, and the shell script fop if on Unix/Linux.
Now, open your system’s command line. On Windows this can be done
by pressing the windows key and R, then entering cmd. Now navigate to your fop-2.0 folder. This is
done on windows by typing “cd [file directory here]” replacing the square brackets
with the fop-2.0 folder’s file path. Hint: paste it in.
Now, for a test run type fop and press enter. You should get a
large screen of gibberish, with the last few lines being some example commands.
Now, paste the following command into the command line:
fop output.fo labels.pdf
Now let the command line idle until you get the input screen
again. Now check the fop-2.0 folder, and there should be a file called
labels.pdf with your labels in them. Well done, give yourself a well-deserved
pat on the back for dealing with this stupidly convoluted system!
Troubleshooting
-
The XSL
transformer gives some kind of an error.
o
Re-edit the UBUCManual.xml file carefully.
Make sure that the item group tags are intact after your deleting, and that
each item tag has a “<item” at the
start and a “/>” at the end.
-
When
attempting to use the command line to change directories it’s giving you an
error
o
There may be spaces in the file path of the
fop-2.0 folder. Correct this and try again
-
When
attempting to use the command line to access FOP, it says that there is no
command called fop.
o
Download the newest version of Java, and then
run the .bat or shell script again.
-
The pdf
contains the wrong stickers/stickers for items I do not care about
o
Edit the XML file again, creating a new
UBUCManualEdit.xml. Make sure that the items you want stickers for are within
the itemgroup tags with
the id “colregs”, as otherwise the transformation
will not work.
-
When
calling the fop command from the command line, it gives you some sort of error immediately
o
Make sure that the output from the XSL
transformer is saved as output.fo, and that you typed the command correctly,
character for character.
-
After
entering the fop command, the command line hangs for a while and then gives an
error without making a pdf.
o
FOP has done something stupid. Check the
official FOP documentation (time for some google-fu),
and see what it says. If you don’t understand what it says, don’t worry,
neither do I. But you’re probably stuck with making labels. Ask someone like
Tim Walsh, or Sam Walder for help.