You are here:About>Computing & Technology>Focus on Linux
About.comFocus on Linux
Linux / Unix Command: cdlabelgen
Command Library

NAME

cdlabelgen - CD jewel case inserts creator. Generates frontcards and traycards for CD cases  

SYNOPSIS

cdlabelgen [ -c <category> -s <subcategory> -i <item1%item2%etc> -f <itemsfile> -v <num_items_cover> -e <cover_epsfile> -S <cover_eps_scaleratio> -E <tray_epsfile> -T <tray_eps_scaleratio> -d <date> -D -o <outputfile> -t <template> -b -w -h -m -M -p ]  

DESCRIPTION

cdlabelgen's purpose in life is twofold:
* To be run automatically and swiftly from a shell script and automatically generate a frontcard and a traycard for a cd---usually data archive cd's. The traycard (which goes behind the CD itself) is U-shaped and the ends of the CD case bear the label of what the CD is.
* To have a minimum of dependencies---cdlabelgen only requires perl.

cdlabelgen was designed to simplify the process of generating labels for CD's. It originated as a program to allow auto generation of frontcards and traycards for CD's burned via an automated mechanism (specifically for archiving data), but has now become popular for labelling CD compilations of mp3's, and copies of CDs. Note that cdlabelgen does not actually print anything---it just spits out postscript, which you can then do with as you please.

The latest version of cdlabelgen as well as this document can be found at http://www.aczone.com/tools/cdinsert/. The software package includes CGI scripts that can be used to serve cdlabelgen over the internet. An older version may be available at: http://www.red-bean.com/~bwf/software/cdlabelgen/.

Thanks to some really hairy postscript from GNUPlot, cdlabelgen now supports arbitrary ISOLatin font characters. This means that you can print out characters like æøåÆØÅ (ASCII \230, \248, \229, \198, \216 and \197)

cdlabelgen comes with several eps images for you to use on your labels. These images can be found in /usr/local/lib/cdlabelgen or /usr/share/cdlabelgen or /usr/local/share/cdlabelgen, depending on your installation. Included are a Recycling icon, an mp3 icon, the Compact Disc icon (with and without 'Digital' on it), Tux the penguin, and the new Debian 'swirl' logo. Two color background images called Music Notes are also available.

Note that cdlabelgen now prints a 'tongue' as part of the traycard. This folds around and is viewable from the front in jewel boxes that are entirely clear (CD holder piece is not opaque). If you do not have a clear CD holder in your jewel box, you may find it easier to just cut the 'tongue' off---it's a bit easier to fold without it.

cdlabelgen requires Perl Version 5.003 or greater. Ghostscript is not required, but is recommended so that you can test out your labels without wasting paper.  

SWITCHES

-c category
Set the category (title) for the CD
-s subcategory
Set the subcategory (subtitle) for the CD
-i items
'items' should be a '%' separated list of items to print on the traycard of the CD. Note that if the number of items are too many to fit on the tray card, cdlabelgen will leave out some items at the end. cdlabelgen automatically flows the items into 2, 3, 4, or 5 columns and scales the fontsize accordingly, unless the "-P" option is used. You can insert blank lines by inserting 2 percent signs in a row into the items list.
-f filename
Get item names from file named filename. Each item should be on its own line separated by carriage returns. cdlabelgen automatically flows the items into 2, 3, 4, or 5 columns and scales the fontsize or clips the items as needed. You can insert blank lines by placing blank lines between items in this file
-v number_of_items_for_cover
Normally, all the items are printed on the tray card. But if you have a large number of items, you may wish to print some items on the cover, and rest on the tray card. This option provides a way of specifying how many items should be printed on the cover. Default is 0 (i.e., print no item on the cover, print all items on the tray). The items to be printed on the cover are taken from the list of items, from the top of the list. Note that if the number of items is too many to fit on the cover, it will result in items being dropped. As of Jan 2002, around 250-300 items can be fitted on the cover or the tray, depending on whether a title/subtitle/date is used or not.
-d date
Set the date to be used as 'date' if not set or not overridden with the -D flag, today's date will be used (default is today's date). Use this option if you don't like cdlabelgen's default format of YYCC-MM-YY, for example.
-D
Do not print any date (overrides -d as well)
-e cover_epsfile
Filename of eps file to print on cover. Note that cdlabelgen requires that the eps file contain a proper '%%BoundingBox LLx LLy URx URy' declaration according to the PostScript Document Structuring Conventions. cdlabelgen uses this line to determine the dimensions of the eps graphic so that it can position it appropriately on the cover. Note that cdlabelgen first looks for this file in your working directory. If it doesn't find it there, it will look in the list of directories where the default eps files are stored (see @where_is_the_template). This makes it easy to use the images shipped with cdlabgelgen without typing miles of pathnames.
-S cover_eps_scaleratio
The ratio by which you want to scale the epsfile that appears on the cover. If you omit this flag, cdlabelgen assumes a scaleratio of 1.0. This flag allows you to squeeze larger graphics into the cover or expand smaller graphics to fill the cover. Scaleratio must be a number (int or float).

If the value passed is 0.0 (note: not 0, but 0.0), then the logo is used as a background image - it will be scaled as required to fit the entire cover.

-E tray_epsfile
Filename of eps file to print on traycard. Note that cdlabelgen requires that the eps file contain a proper '%%BoundingBox LLx LLy URx URy' declaration according to the PostScript Document Structuring Conventions. cdlabelgen uses this line to determine the dimensions of the eps graphic so that it can position it appropriately on the cover. Note that cdlabelgen first looks for this file in your working directory. If it doesn't find it there, it will look in the list of directories where the default eps files are stored (see @where_is_the_template). This makes it easy to use the images shipped with cdlabgelgen without typing miles of pathnames.
-T tray_eps_scaleratio
The ratio by which you want to scale the epsfile that appears on the traycard. If you omit this flag, cdlabelgen assumes a scaleratio of 1. This flag allows you to squeeze larger graphics into the traycard or expand smaller graphics to fill the traycard. Scaleratio must be a positive number (int or float) specifying the scale.

If the value passed is the word fill1, then the image is used as a background - it is scaled so that it completely fills the interior tray card region. The value 0.0 (note: not 0, but 0.0) works same as the fill1 argument.

If the value passed is the word fill2, then the image is used as a background - it is scaled so that it completely fills the tray card region, including the 'tongue' end-caps.

-o outputfile
If the -o flag is used, cdlabelgen prints to outputfile instead of STDOUT.
-t template
Specify explicitly which template to use. This is useful if you need to debug the PostScript code in the template, use a different template, or if you have created your own template to use in lieu of the one provided with cdlabelgen.
-b
Suppresses printing of the Plaque on the traycard, thus allowing you to either fit even more items on the traycard, or to use a slightly larger font size for the items.
-h
print out the usage message
-w
Enables word wrapping of the items that print on the traycard. Note that this is *not* extensively tested and may be buggy! Make sure that you preview your label before printing it if you use this flag.

If there is a problem with "-w", the best option right now is to split lines in the input itself, and to omit the "-w" option.

-m
Creates covers suitable for use in slim cd-cases, this means no tray card (the tray card is now the inside front cover). This creates a two page, folding cover insert. This could also be used in normal cd cases.
-M
Creates covers suitable for use as envelopes for a CD. Guide lines are printed, to aid in folding the printout correctly.
-p
Enables clipping of items; uses fixed font size for all items. Normally, the template.ps used by cdlabelgen will try to fit an item in a given column by reducing the font size if needed. This is ok if done for one or two items, but if done too often, it makes the tray card look ugly, with text of varying font sizes.

Use this option to use a fixed width font for all items. If the item is too large to fit in a column, the text will be clipped instead.

 

EXAMPLES

    ./cdlabelgen -c "My Filesystem" -s "/usr/local/foo" -e postscript/recycle.eps > foo.ps

    ./cdlabelgen -c "title of cd" -s "subtitle" -i "Item 1%and Item 2%a third item here perhaps" -e postscript/recycle.eps > bar.ps

    ./cdlabelgen -c "Fitz" -s "home directory" -o qux.ps

 

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

From Juergen Haas,
Your Guide to Focus on Linux.
FREE Newsletter. Sign Up Now!
Newsletters & RSSEmail to a friendSubmit to Digg
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.