The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PostScript::Barcode - barcode writer

VERSION

This document describes PostScript::Barcode version 0.006.

SYNOPSIS

    # This is abstract, do not use directly.

DESCRIPTION

By itself alone, this role does nothing useful. Use one of the classes residing under this namespace:

PostScript::Barcode::azteccode
PostScript::Barcode::datamatrix
PostScript::Barcode::qrcode

INTERFACE

See "THE TYPES" in Moose::Manual::Types about the type names.

Attributes

data

Type Str, required attribute, data to be encoded into a barcode.

pack_data

Type Bool, whether data is encoded into PostScript hex notation. Default is true.

move_to

Type PostScript::Barcode::Meta::Types::Tuple, position where the barcode is placed initially. Default is [0, 0], which is the lower left hand of a document.

translate

Type Maybe[PostScript::Barcode::Meta::Types::Tuple], vector by which the barcode position is shifted. Default is undef, no position shifting.

scale

Type Maybe[PostScript::Barcode::Meta::Types::Tuple], vector by which the barcode is resized. Default is undef, no size scaling.

bounding_box

Type PostScript::Barcode::Meta::Types::TuplePair, coordinates of the EPS document bounding box. Default values are automatically determined through the Ghostscript bbox device, see http://ghostscript.com/doc/current/Devices.htm#Bounding_box_output.

Methods

post_script_source_code

Returns EPS source code of the barcode as string.

render

    $barcode->render;
      # use defaults, see below
    $barcode->render(-sDEVICE => 'epswrite');
    $barcode->render(-sDEVICE => 'pdfwrite');
    $barcode->render(-sDEVICE => 'svg');

Most of the time the simple examples above are sufficient.

    $barcode->render(-sDEVICE => 'pnggray', -sOutputFile => 'out.png',);
      # overrides some default values
    $barcode->render(-dEPSCrop => undef, -g => undef,);
      # disables some default values

Takes an list of initialisation arguments. The argument names start with a dash, see the explanation at "init_with_args" in GSAPI and http://ghostscript.com/doc/current/Use.htm#Invoking. Renders and writes the barcode image binary data to the specified file name.

options list atoms

  • a pair of Str and Value which results in a -key=value option

  • a pair of Str and Undef which disables a boolean option that was enabled by default by this module

  • a Str which enables a boolean option.

options defaults

qw(-dBATCH -dEPSCrop -dNOPAUSE -dQUIET -dSAFER -gXXXxYYY -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sDEVICE=pngalpha -sOutputFile=-), meaning the barcode is rendered as transparent PNG with anti-aliasing to STDOUT, with the image size automatically taken from the "bounding_box".

EXPORTS

Nothing.

DIAGNOSTICS

None.

CONFIGURATION AND ENVIRONMENT

PostScript::Barcode requires no configuration files or environment variables.

DEPENDENCIES

Configure time

Perl 5.10, Module::Build

Run time

core modules

Perl 5.10, List::Util

CPAN modules

Alien::BWIPP, IO::CaptureOutput, GSAPI, Moose, Moose::Role, Moose::Util::TypeConstraints, MooseX::Singleton

INCOMPATIBILITIES

After version 0.003 the type constraint for "bounding_box" changed.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to http://github.com/daxim/PostScript-Barcode/issues, or send an email to the maintainer.

TO DO

add classes for the other barcodes

Suggest more future plans by filing a bug.

AUTHOR

Distribution maintainer

Lars Dɪᴇᴄᴋᴏᴡ <daxim@cpan.org>

Contributors

See file AUTHORS.

LICENCE AND COPYRIGHT

Copyright © 2010 Lars Dɪᴇᴄᴋᴏᴡ <daxim@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0.

Disclaimer of warranty

This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

ACKNOWLEDGEMENTS

I wish to thank rillian on Freenode. Without your help, I would not have got this project off the ground.

SEE ALSO

irc://irc.freenode.net/ghostscript