Tags:
rendering2Add my vote for this tag create new tag
, view all tags

BarcodePlugin

Create Code128 barcodes embedded in TWiki pages

Introduction

This plugin is used to create embedded barcodes in topics. Currently only Code128 codes are supported. Support for other standard codes could easily be added for any standard supported by Perl Barcode or GD::Barcode modules.

The original inspiration for this was so I could generate barcodes that can be read by a CueCat

One useful application is to print out a page with the Topic name encoded in the barcode. Then use the scanner to quickly jump to the Wiki page for editing. ie. %BARCODE{text="%TOPIC%"}%

Syntax Rules

The %BARCODE{parm="value" ...}% variable gets expanded to an image representing the barcode.

%Barcode% Parameter Comment Default
text The text to encode "R.T.F.M."
padding Size of whitespace before & after barcode 5
height Height of barcode. Set to "0" for minimum size. Must be at least 15% of the width of the final barcode. 0
scale How many pixels for the smallest barcode stripe 2
border Size of the black border around the barcode 0
font Font for the text at the bottom. Font may be one of the following: "giant", "large", "medium", "small", or "tiny". Or, it may be any valid GD font name, such as "gdMediumFont". "medium"
font_align Align the text ("left", "right", or "center") "center"
transparent_text 0/1: use transparent background for text? 1 - Transparent
show_text 0/1: Show text under the barcode 1 - Text is shown
cue_cat 0/1: Swap upper and lower case for Cue Cat 0 - No swap

BarcodePlugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, for example, %DEFAULTPLUGIN_SHORTDESCRIPTION%

  • One line description, shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Create Code128 barcodes embedded in TWiki pages

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Examples

You type ... Expect output If Installed
%BARCODE{text="Hello" transparent_text="0" height="0" }% example_0.png %BARCODE{text="Hello" transparent_text="0" height="50"}%
%BARCODE{text="BarcodePlugin2004" scale="1"}% example_1.png %BARCODE{text="Barcode01234" scale="1"}%

I use this to generate a table of topics with the topic encoded in a barcode. I then use a cuecat to scan the barcode and take me to the relevent page. Here is the verbatim code, note the use of the "$percent" to escape the BARCODE tag in the formatted search:

%TABLE{ sort="on" tableborder="1" cellpadding="1" cellspacing="3" headerbg="#666699" 
headercolor="#FFFFCC" databg="#CCCCCC, #EFEFEF" headerrows="1" footerrows="1" }%
|*Box Database</b>%ENDCOLOR%*||||
|*Box #*|*Location*|*Owner*|*Barcode*|*Contents*|
%SEARCH{ "HouseBox[0-9][0-9][0-9]" scope="topic" regex="on" nosearch="on" nototal="on" format="
| [[$topic]] | $formfield(HouseBoxLocations) |  $formfield(HouseBoxOwners) 
| $percntBARCODE{text=$topic scale=1 padding=20}$nop% 
|$formfield(Description)|" }%

Plugin Installation Instructions

Note: You do not need to install anything on your browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Make sure your Perl administrator has installed the Barcode::Code128 module. (perl -MCPAN -e "install Barcode::Code128")
  • Make sure you have GD 1.20 or later installed.
  • Download the ZIP file from the Plugin web (see below)
  • Unzip BarcodePlugin.zip in your twiki installation directory. Content:
    File: Description:
    lib/TWiki/Plugins/BarcodePlugin.pm Plugin Perl module
    data/TWiki/BarcodePlugin.txt Plugin topic
    pub/TWiki/BarcodePlugin/example_0.png Sample barcode image
    pub/TWiki/BarcodePlugin/example_1.png Sample barcode image
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the plugin is correctly installed:
    • Check above examples if the "if installed" column shows images instead of variables.

Plugin Info

Plugin Author: TWiki:Main.StevenSprouse
Copyright: © 2004 TWiki:Main.StevenSprouse
© 2004-2010 TWiki:TWiki.TWikiContributor
Plugin Version: 2010-12-12
Change History:  
2010-12-12: TWikibug:Item6530: Doc improvements, changing TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny
11 Nov 2004 v1.002 - Improved benchmarks by changing Perl module load timing.
5 Nov 2004 v1.001 - Added cue_cat flag
4 Nov 2004 v1.000 - Initial release
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: Barcode::Code128
  GD v1.20 or later
Other Dependencies: none
Perl Version: 5.0
TWiki:Plugins/Benchmark: GoodStyle 100%, FormattedSearch 100%, BarcodePlugin 100%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/BarcodePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/BarcodePluginDev & TWiki:Main/StevenSprouse

Related Topics: TWikiPreferences, TWikiPlugins, EmptyPlugin

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 BarcodePlugin.md5 r4 r3 r2 r1 manage 0.2 K 2010-12-12 - 23:26 PeterThoeny  
Compressed Zip archivetgz BarcodePlugin.tgz r4 r3 r2 r1 manage 7.8 K 2010-12-12 - 23:26 PeterThoeny  
Compressed Zip archivezip BarcodePlugin.zip r11 r10 r9 r8 r7 manage 9.8 K 2010-12-12 - 23:25 PeterThoeny  
Unknown file formatEXT BarcodePlugin_installer r2 r1 manage 3.5 K 2010-12-12 - 23:26 PeterThoeny  
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2013-10-16 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.