University of Colorado Colorado Springs banner
Login to LibApps.

Print Templates Archive: Combined Spine & Pocket Label

Getting Started

Objective of this Example

  • Set the system to use print templates for spine labels output
  • Export the default spine label template out of the system
  • Edit the template with Jasper iReport
  • Import the template into the system
  • Test template output

Our Environment

  • Window7 Enterprise SP1 x64
  • Millennium 2011 R1.3 & Sierra 1.1.3_4
  • Jasper iReport 4.0.2
  • HP Laserjet 2430
  • Gaylord SLB label (47-281)

Dimensions:
Spine Label: 1 5/8H x 7/8"W
Circulation Label: 1 5/8H x 2 7/8"W
Sheet: 8 1/2 x 11"

 Important things to Know About Printing Spine Labels with Print Templates

  • A graphics-capable local printer is required for print templates
  • Print templates print an "image", not text
  • Old tractor fed printers usually won't work (not graphics capable)
  • Printing can be immediate or labels can be queued
  • Monographic label queues are only saved for the duration of a session
  • Logging out of Millennium/Sierra will warn that the queues will be emptied

 

 

Export the Template-Millennium

To export the template to your computer...

1)  Highlight the template that you want to export and click Export.

    

2)  Select the location where you wish to export the template, confirm that the directory (folder) path is correct within the File Name: field, then select Choose Directory.

 

**Hint: You may want to create a directory within C:\Millennium called 'Print Templates' to store all exported templates.**

 

Things to keep in mind…

  • Format of the files is jrxml (Jasper Report XML)
  • If you have files in the directory you are exporting to, you can't see them in the Choose a directory window
  • If you have a file with the same name as the one you are exporting, it will be overwritten (without warning)
  • Do not enter a file name.  The system will automatically name these exports
  • Graphic files used in templates are stored separately, and are exported automatically

 

Repeat the above process if you want to export other templates, and then select OK  to close the Settings window

 

 

Export the Template-Sierra

To export the template to your computer...

1)  Highlight the template that you want to export and click Export.

      

 2)  Select the location where you wish to export the template, confirm the directory path is correct within the File Name: field, and then select Choose Directory.

 

 **Hint: You may want to create a directory within C:\Millennium called 'Print Templates' to store all exported templates.**

Things to keep in mind…

  • Format of the files is jrxml (Jasper Report XML)
  • If you have files in the directory you are exporting to, you can't see them in the Choose a directory window
  • If you have a file with the same name as the one you are exporting, it will be overwritten (without warning)
  • Do not enter a file name.  The system will automatically name these exports
  • Graphic files used in templates are stored separately, and are exported automatically

 

Repeat the above process if you want to export other templates, and then select OK  to close the Settings window

Editing

The default template,  _47821Gyld, is for printing a combined spine/pocket label on an 8.5 x 11 sheet labels.

Dimensions:

  • Spine Label: 1 5/8H x 7/8"W
  • Circulation Label: 1 5/8H x 2 7/8"W
  • Sheet: 8 1/2 x 11"

 

**NOTE: Measurements in iReport are in "points" not inches. It may be useful to find a measurement conversion tool online. Here is an example of one: http://www.thecalculatorsite.com/conversions/length/points-to-inches.php **

** NOTE: This example only shows how to work with the LC call number format. **

 

Example that shows the anatomy of a LC call number:

This image is from InnoU Online Course: Customizing Print Templates: Spine labels

 

1)  Navigate to the directory where the default template was exported during the export Print Template process and open file with Jasper iReport (.jrxml).

 

 

 

2)  Immediately save the file with a different name.

 

**NOTE: It is beneficial to save these files with some kind of version control naming convention, that way if something goes wrong you can easily go back to a version that worked before a change. **

** For example: SPLv0x0.jrxml  - stands for Spine Pocket Label version 0.0 **

 

 

 

 3)  Look at the default Print Template data fields and make a list for the changes to be made

 

iReport Preview (**NOTE: you do not see the data fields in preview**)

 

 

Changes to "47281GYLD.jrxml"

  • Modify so decimals for cutters show on spine and pocket

**NOTE:  The field elements callSuba, callEndCR, callSubb, and callSubbCR all drop the decimal point (Millennium Reference page 107534).**

  • Remove Library name
  • Move Author field after Call# and before Title on Pocket
  • Move all fields so everything starts on top of label and is left justified
  • Include more title subfields
  • Remove item's barcode

Editing (cont.)

Steps to make the changes

1)  To remove a text field select it and delete it.  The deletion can be done either with the delete key, or right-click then select delete.

 

a. Delete Library name - 'acctname'

b. Delete Items barcode - 'itemb'

The template should now look like the following:

                               

 

2)  To move the text fields on the pocket, left-click on the data field and drag it into the desired position

 

**NOTE: guide lines will appear that will help with aligning the field with other elements within the template.**

 

 

a. Reorder the following fields from top to bottom, and left-justified them.

Call# - 'callAlphaStart...'

Author - 'biba'

Title - 'bibt'

 

The template should now look like the following:

 

 3)  To add conditional statement to show decimals for cutters on spine label, left-click on the text field to select it. Then right-click on the text field, and select edit expression.

 

 a. The Expression editor will now appear.  Select the whole text line and delete

 

 

 

 b. Paste the following java expression code:

**NOTE: This java expression was developed by Steve McDonald, Tufts University.  This can be found on the CSDirect Wiki.**

 

http://csdirect.iii.com/lswiki/PrintTemplates/SpineLabelTips#Formatting_Library_of_Congress_c

 

** A complete description on how this code works can be found at: **

 

http://csdirect.iii.com/lswiki/PrintTemplates/LCCallNumberScript

 

                                        ** Be careful when copying and pasting.  You may want to paste the expression first into a simple text editor.  Then do some cleanup  and paste it into iReport **      

**********************************************************

$F{callAlphaStart}.trim() +
($F{callAlphaStart}.equals("") ? "" : "\n") +
$F{callNumericStart} + $F{callNumericAfterDec} +
(($F{callNumericStart} + $F{callNumericAfterDec}).equals("") ? "" : "\n") +
($F{callSuba}.matches("(?s)[A-Z].*") ? "." : "") +
($F{callSuba}.matches("[0-9a-zA-Z]*\\.[A-Z].*") ? ($F{callSuba}.substring(0,$F{callSuba}.indexOf(".")) + "\n" +
$F{callSuba}.substring($F{callSuba}.indexOf("."),$F{callSuba}.length())) : $F{callSuba}).trim().replaceAll("\\s","\n") +
($F{callSuba}.equals("") ? "" : "\n") +
($F{callSubb}.matches("(?s)[A-Z].*") ? ($F{callSuba}.matches("(?s)[A-Z].*") ? ($F{callSuba}.matches(".* .*") ? "." : "") : ($F{callSuba}.matches(".*\\..*") ? "" : ".")) : "") +
$F{callSubb}.trim().replaceAll("\\s","\n").replaceAll("\\.\\s",".").replaceAll(",\\s","\n").replaceAll("\\smaj\\."," maj.\n").replaceAll("\\smin\\."," min.\n") +
($F{callSubb}.equals("") ? "" : "\n") +
$F{itemv}.trim().replaceAll("[ :]","\n").replaceAll("\\.\\s",".").replaceAll(",\\s","\n")

The Expression editor should now look like the following:

 

 c. Select Apply to make changes.  This will close the Expression Editor.

 

d. Now add the conditional statement to show decimals for cutters on pocket label. Follow the same procedure that was used above for modifying the Call# on the spine using the Expression Editor.

e. Paste the following java expression code into the pocket text field for Call#:

**NOTE: The same java expression as the spine, but need to have spaces instead of new line**

$F{callAlphaStart}.trim() +
($F{callAlphaStart}.equals("") ? "" : " ") +
$F{callNumericStart} + $F{callNumericAfterDec} +
(($F{callNumericStart} + $F{callNumericAfterDec}).equals("") ? "" : " ") +
($F{callSuba}.matches("(?s)[A-Z].*") ? "." : "") +
($F{callSuba}.matches("[0-9a-zA-Z]*\\.[A-Z].*") ? ($F{callSuba}.substring(0,$F{callSuba}.indexOf(".")) + " " +
$F{callSuba}.substring($F{callSuba}.indexOf("."),$F{callSuba}.length())) : $F{callSuba}).trim().replaceAll("\\s"," ") +
($F{callSuba}.equals("") ? "" : " ") +
($F{callSubb}.matches("(?s)[A-Z].*") ? ($F{callSuba}.matches("(?s)[A-Z].*") ? ($F{callSuba}.matches(".* .*") ? "." : "") : ($F{callSuba}.matches(".*\\..*") ? "" : ".")) : "") +
$F{callSubb}.trim().replaceAll("\\s"," ").replaceAll("\\.\\s",".").replaceAll(",\\s"," ").replaceAll("\\smaj\\."," maj.\n").replaceAll("\\smin\\."," min.\n") +
($F{callSubb}.equals("") ? "" : " ") +
$F{itemv}.trim().replaceAll("[ :]"," ").replaceAll("\\.\\s",".").replaceAll(",\\s"," ")

The template should now look like the following:

 

 5)  Now add the java expression to  show the b subfields from the 245 or 200.

a. Follow the same procedure that was used above for modifying the Call# on the spine using the Expression Editor.

b. Paste the following java expression code into the pocket text field for Title

($F{bibt}.trim() + " ") + ($F{bib245b}.trim() + " ")

6)  Save the template.  The desired editing has been completed.

 

Importing Back into Millennium

1)  Select Settings from the Admin menu.

2)  Select the Print Templates Tab.

3)  Select  Spine Label from Output Type drop-down menu.

4)  Verify that Use Print Templates is checked.

5)  Select Import.

 

6)  Navigate to the directory where the custom template was stored.

7)  Select the custom template file and choose to Open.

 

8)  A Print Template Name/Description window will appear.  Fill in the fields with appropriate information and choose OK.

 

9)  Select the custom template that was just imported and choose the arrow pointing to Preferred Templates to move it over.

 

10)  Select the custom template again and choose Preview.

 

A Preview Window will now appear.  This is a good way to test that Millennium can open the template.

 

**NOTE: you do not see any injected data fields in preview**

 

 

 

11)  Close the Preview Window and choose Save Settings. Then OK.

 

 

 

Importing Back into Sierra

1)  Select Settings from the Admin menu.

2)  Select the Print Templates Tab.

3)  Select  Spine Label from Output Type drop-down menu.

4)  Verify that Use Print Templates is checked.

5)  Select Import.

 

6)  Navigate to the directory where the custom template was stored.

7)  Select the custom template file and choose to Open.

 

8)  A Print Template Name/Description window will appear.  Fill in the fields with appropriate information and choose OK.

 

9)  Select the custom template that was just imported and choose the arrow pointing to Preferred Templates to move it over.

 

10)  Select the custom template again and choose Preview.

 

A Preview Window will now appear.  This is a good way to test that Millennium can open the template.

 

**NOTE: you do not see any injected data fields in preview**

 

 

 

11)  Close the Preview Window and choose Save Settings. Then OK.

 

 

 

Testing

1)  Add 12 items to the spine label print queue.

  1. Bring up and item record
  1. Go to Tools
  1. Select Queue Spine Labels to Print
  1. Select Queue 1

 

2)  After queuing 12 spine label, take a look at the queue.

  1. Go to Tools
  1. Select View Label Queues

 

 

3)  A View Spine Label Queue will open.  Choose Print.

 

4)  After choosing to print the labels, the print job will be sent to the printer.

There will be a window that will appear asking, "Printed successfully?"

You may want to keep the labels in the queue if more modifications are needed.

 

 

 At this point the labels will be sent to the printer.  Make sure it printed the way that it was intended.