Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: translation request PDF::API old barcode call to new PDF::API

by idsfa (Vicar)
on Feb 20, 2006 at 19:31 UTC ( [id://531504]=note: print w/replies, xml ) Need Help??


in reply to translation request PDF::API old barcode call to new PDF::API

To say that the documentation on this package is terrible would falsely imply that it existed at all ... A meditation or two have tried to gather some info on this package, but neither is this deep in the PDF::API2 tree.

That said, I'll dig in a little. The pod contains a promising function, and diving into the guts shows that it will take all of your options except -type and -text. I don't know if you will need them to get the output you are looking for. Maybe the following will help:

use PDF::API2; my $pdf = PDF::API2->new(-file => 'barcode.pdf'); my $bc = $pdf->xo_codabar( -font => $pdffont, -code => $code, -quzn => $quzn, -umzn => $umzn, -lmzn => $lmzn, # fontsize at bottom -zone => $zone, -ofwt => $owft, -fnsz => $fnsz, -spcr => $spcr, ); $pdf->save();

Updated: So naturally, another example appears the next day. Doesn't directly help with this problem, but I'm adding the link here just to keep track of it.


The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: translation request PDF::API old barcode call to new PDF::API
by madizen (Sexton) on Feb 20, 2006 at 20:50 UTC
    Documentation? er... what's that? ;) The -type arg is obviously not needed anymore and I think I can add back the -text label (it is important) just by sending that to the pdf document separately from the barcode, as I have working examples of sending text to the document. However... while pdf->xo_codabar() now returns something, I need to place it on the page at a specific location. This used to be like this:
    # encode string $code as codabar image $bar my $bar = makebarcode ($code); # Working! Thank you! # Place it at x,y page coordinates with scale and frame options. # Doesn't work. $gfx->barcode($bar, $x, $y, $scale, $frame); # Don't work neither. $gfx->xo_codabar($bar, $x, $y, $scale, $frame)
    Now I get: Can't locate object method "what_I_tried" via package "PDF::API2::Content" Well, that's progress anyway. Just acquiring the barcode image was 80% of my battle. I will mull the meditations offered, but if you or anyone can just throw me the required "output $bar at coordinates" incantation, I have the rest of my legacy issues already wrapped. I found and tried:
    $gfx->image($bar, $x, $y, $scale);
    But $bar is not an image? (Anyway I get a blank document, which is better than an error message). Found it!
    # Works! $gfx->formimage($bar, $x, $y, $scale);
      Hey there.. Do you have a full example of this code? I am trying to do almost the exact same thing. What I need to do is create and print individual barcodes that will print onto Avery labels. Thanks, ~Donavon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://531504]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-16 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found