logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Barcode::DataMatrix::PNG - Generate PNG graphical representations of Data Matrix barcodes

Attributes

barcode
       Ascii string data to be inserted into the barcode.

   resolution
       The resolution (in pixels) of the barcode to be generated.   The default setting is 3 pixels resolution.

   target
       Default output is "stdout".  Options are "stdout" or "pass".  Pass will "return()" the barcode PNG data
       for use.

Author

       Kasem Omary<< <kasemo@cpan.org> >>

Description

       This class is used to create graphical representations of data matrix barcodes.  It is an extension of
       the Barcode::DataMatrix class.  Potential applications include graphically oriented documents such as
       PDF, printable web documents, invoices, packing lists, shipping labels, etc....

Methods

new(%attributes)
       Minimal initiation of a barcode object is new(barcode=>"yourtext").  Options may be added via the
       %attributes in any order.

       Default settings of output to "STDOUT" with a resolution of 3 pixels will be used unless changed.

   encode()
       Encode the barcode string into DataMatrix format.  An "encode()" must be completed prior to rendering a
       barcode.

   render()
       Render a PNG image of the created barcode.  The graphic will be rendered based on settings selected.

       An exception may be thrown by foundation classes if they are unable to generate the barcode data or
       graphics.

   echo_barcode()
       Echo a human-readable representation of the barcode data stored in $this->{"barcode"}

Name

       Barcode::DataMatrix::PNG - Generate PNG graphical representations of Data Matrix barcodes

See Also

       HTML::Barcode::DataMatrix

Source Repository

       <https://github.com/KasemOmary/Barcode-DataMatrix-PNG>

Synopsis

           use Barcode::DataMatrix::PNG;
           my $data = Barcode::DataMatrix::PNG->new->(barcode=>'test_barcode');
                                                                                               # Minimal call for a new object.
               $data->encode();                                                # Encode the Barcode data.
               $data->render();                                                # Default:  Render the image to <STDOUT>
               $data->target = 'pass';                                 # C<return()> the image.
               my $barcode = $data->render();                  # Return a PNG representation of a DataMatrix Barcode.
               my $my_barcode = $data->echo_barcode(); # Return a human-readable string of the encoded data.

               $data->barcode = "A new barcode.";              # To render a new barcode with the same object.
               $data->target = 'stdout';
               $data->encode();
               $data->render();                                                # etc.

See Also