• Publicidad

PDF::API2 Barcode

Aquí encontrarás todo lo que sea específicamente acerca de módulos de Perl. Ya sea que estás compartiendo tu módulo, un manual o simplemente tienes una duda acerca de alguno.

PDF::API2 Barcode

Notapor Lor » 2010-06-29 19:49 @867

Agradecería muchísimo si me pudiesen ayudar en lo siguiente: Estoy trabajando con el modulo PDF::API2 y necesito insertar en el documento un código de barras. En CPAN la explicación de este tipo de inserciones es casi nula:

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
$bc = $pdf->xo_2of5int %opts
$bc = $pdf->xo_3of9 %opts
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4


Suponiendo que tenga el número a convertir a código de barras y el tipo de código a utilizar, ¿cómo hago la inserción?

¡¡¡¡¡Muchas gracias!!!!! :D
Lor
Perlero nuevo
Perlero nuevo
 
Mensajes: 187
Registrado: 2005-04-28 05:47 @282

Publicidad

Re: PDF::API2 Barcode

Notapor explorer » 2010-06-30 07:52 @369

Esto es lo único que he encontrado, buscando mucho...
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. head2 PDF::API2::Barcode
  2.  
  3. Subclassed from PDF::API2::Hybrid.
  4.  
  5. =item $bc = PDF::API2::Barcode->new $pdfkey, %options
  6.  
  7. Returns a new barcode object (called from $pdf->barcode).
  8.  
  9. B<Example:>
  10.  
  11.         PDF::API2::Barcode->new(
  12.                 $key,
  13.                 -font   => $fontobj,    # the font to use for text
  14.                 -type   => '3of9',      # the type of barcode
  15.                 -code   => '0123456789', # the code of the barcode
  16.                 -extn   => '012345',    # the extension of the barcode
  17.                                         # (if applicable)
  18.                 -umzn   => 10,          # (u)pper (m)ending (z)o(n)e
  19.                 -lmzn   => 10,          # (l)ower (m)ending (z)o(n)e
  20.                 -zone   => 50,          # height (zone) of bars
  21.                 -quzn   => 10,          # (qu)iet (z)o(n)e
  22.                 -ofwt   => 0.01,        # (o)ver(f)low (w)id(t)h
  23.                 -fnsz   => 10,          # (f)o(n)t(s)i(z)e
  24.                 -text   => 'alternative text'
  25.         );
  26.  
  27. B<Note:> There is currently only support for the following barcodes:
  28.  
  29.         3of9, 3of9ext, 3of9chk, 3of9extchk,
  30.         code128a, code128b, code128c, ean128,
  31.         ean13
  32.  
  33. =item $wd = $bc->width
  34.  
  35. =item $ht = $bc->height
  36.  
  37. =head1 AUTHOR
  38.  
  39. alfred reibenschuh
  40.  
  41.  
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
Corresponde a la versión anterior de PDF::API2, así que no deberías copiar el ejemplo literalmente, pero sí ver la definición de las opciones.

Además, en el código de PDF::API2::Resource::XObject::Form::BarCode aparece:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. sub new {
  2.     my ($class,$pdf,%opts) = @_;
  3.     my $self;
  4.  
  5.     $class = ref $class if ref $class;
  6.  
  7.     $self=$class->SUPER::new($pdf);
  8.  
  9.     $self->{' bfont'}=$opts{-font};
  10.  
  11.     $self->{' umzn'}=$opts{-umzn};      # (u)pper (m)ending (z)o(n)e
  12.     $self->{' lmzn'}=$opts{-lmzn};      # (l)ower (m)ending (z)o(n)e
  13.     $self->{' zone'}=$opts{-zone};
  14.     $self->{' quzn'}=$opts{-quzn};      # (qu)iet (z)o(n)e
  15.     $self->{' ofwt'}=$opts{-ofwt}||0.01;        # (o)ver(f)low (w)id(t)h
  16.     $self->{' fnsz'}=$opts{-fnsz};      # (f)o(n)t(s)i(z)e
  17.     $self->{' spcr'}=$opts{-spcr}||'';
  18.  
  19.     return($self);
  20. }
  21.  
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
y ahí hay unas definiciones de las opciones posibles.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: PDF::API2 Barcode

Notapor Lor » 2010-07-05 12:46 @573

¡¡¡¡Muchas gracias por tu tiempo!!!!, ¡¡¡¡el ejemplo me resulto fantástico!!!!
Lor
Perlero nuevo
Perlero nuevo
 
Mensajes: 187
Registrado: 2005-04-28 05:47 @282


Volver a Módulos

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 2 invitados

cron