in reply to Placing 2D Datamatrix on PDF

This basically seems to work, sweeten to taste:

use Barcode::DataMatrix; use PDF::API2; my $x = 100; my $y = 200; my $sz = 10; my $mat = Barcode::DataMatrix->new()->barcode('Hello World'); my $pdf = PDF::API2->open('original.pdf'); my $page = $pdf->openpage(1); my $content = $page->gfx(); for my $i (0 .. $#$mat) { for my $j (0 .. $#{$mat->[$i]}) { if ($mat->[$i][$j]) { $content->rect($x+$sz*$j, $y-$sz*$i, $sz, $sz); } } } $content->fill(); $pdf->saveas('modified.pdf');

Replies are listed 'Best First'.
Re^2: Placing 2D Datamatrix on PDF
by Anonymous Monk on Jan 20, 2014 at 08:46 UTC
    Thank you very much. I'll request the installation of the modules and test this out asap. Regards, Kurt
Re^2: Placing 2D Datamatrix on PDF
by Anonymous Monk on Apr 22, 2014 at 08:37 UTC
    Tested this and it works great ! Thanks, Kurt
Re^2: Placing 2D Datamatrix on PDF
by Anonymous Monk on Nov 04, 2014 at 13:55 UTC
    Hi, I tried the code. After including the necessary packages, I get the below error.
    C:\>perl c:\PerlScripts\test.pl
    String found where operator expected at C:/Strawberry/perl/site/lib/Barcode/Data
    Matrix.pm line 9, near "has "encoding_mode""
            (Do you need to predeclare has?)
    String found where operator expected at C:/Strawberry/perl/site/lib/Barcode/Data
    Matrix.pm line 17, near "has "process_tilde""
            (Do you need to predeclare has?)
    syntax error at C:/Strawberry/perl/site/lib/Barcode/DataMatrix.pm line 9, near "
    has "encoding_mode""
    BEGIN not safe after errors--compilation aborted at C:/Strawberry/perl/site/lib/
    Barcode/DataMatrix.pm line 142.
    Compilation failed in require at c:\PerlScripts\test.pl line 1.
    BEGIN failed--compilation aborted at c:\PerlScripts\test.pl line 1.
    
    C:\>
    
    Please help me out with this. Thanks in advance
      How did you "include the necessary packages"? It seems Barcode::DataMatrix needs Any::Moose, but it's not working correctly.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ