Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

HELP! Label images PostScript

by Tru27roo (Initiate)
on Aug 06, 2013 at 17:19 UTC ( #1048152=perlquestion: print w/replies, xml ) Need Help??
Tru27roo has asked for the wisdom of the Perl Monks concerning the following question:

Hey guys, so I am in need of some serious help! My goal was to generate labels with a barcode. I used the PostScript::MailLabels module for the label set up, and since I want to IMPORT my own barcodes I used the Barcode::Code39 module. Everything is working great except one very serious problem.

The barcode image I upload is uploaded via CGI/html and when I generate my postscript file for the labels it can NOT read my barcode image. It instead prints out the code to show the image ($Cgi->img({-src => "data:image/gif;base64,$barcode_64"});

My question is, is there some way I can make this image appear through post script? When I generate my labels how can I get my barcode to appear?

labels->labelsetup( Avery => $labels->averycode(8160), PaperSize => 'letter', Font => 'Times-Roman', Y_Adjust => 1 / 16, X_Adjust => 1 / 16, ); #Generate image foreach my$row (@$rows) { my $barcode = (GD::Barcode::Code39->new('*'.$row->[1].'*')->plot(N +oText=>1, Height=>20)->gif()); my $barcode_64 = encode_base64($barcode); my $barcode_image = $Cgi->img({-src => "data:image/gif;base64,$bar +code_64"}); #Array with label data we need push(@data, [$row->[3] . " " . +$row->[5] . " " . $row->[6], "CMDM# " . $row->[0] . " ". "Copy# " . $ +row->[4], $barcode_image, $row->[1],"Property of Me"]); } print $Cgi->header(-type => "application/ps", -attachment => ''), $labels->makelabels(\@data);

Replies are listed 'Best First'.
Re: HELP! Label images PostScript
by moritz (Cardinal) on Aug 06, 2013 at 18:00 UTC
Re: HELP! Label images PostScript
by Loops (Curate) on Aug 06, 2013 at 18:59 UTC


    Welcome to the monastery.

    When you say that everything is working great, have you actually been able to generate and view a .ps file that contains a label with your barcode on it? Are you sure that the problem you're having is CGI, or is it that your postscript file isn't actually correct?

    I ask because it seems the PostScript::MailLabels does not support embedding graphics. Take a look at the documentation "todo" section to see that it is planned in the future. So it appears you're just loading up a text field with data that has no hope of being interpreted as a graphic image.

    If true, you may have to do your own label alignment code.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1048152]
Approved by ww
[Eily]: though honestly, I'm sure I have seen people use closure to mean anonysub for perl as well
[stonecolddevin]: good morning friends
[LanX]: yes, mainly pseudo Perl experts
[Eily]: good morning stonecolddevin
LanX has to go/
[Eily]: bye LanX
[LanX]: bye :)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2018-02-23 17:19 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (305 votes). Check out past polls.