koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: [Koha-devel] Problems with barcode generation]


From: Pedro Faria
Subject: [Fwd: Re: [Koha-devel] Problems with barcode generation]
Date: Thu, 24 Aug 2006 10:36:14 +0100
User-agent: Thunderbird 1.5.0.4 (X11/20060614)

Michael Hafen escreveu:
I had the same problem.  To get the barcodes I had to use a different
function entirely.

I've actually made a lot of changes to this script, but I will post the
relevant bit for your benefit.

-------------  CUT  --------------

		my $zone = length($code) - 5;
		my $barcode = $pdf->xo_3of9(-font => $tr,	# The font object to use
					    -code => $code, # Text to codify
					    -ext  => 1,		# extended character set
					    -extn => '012345',	# Barcode extension (if it is aplicable)
					    -umzn => 9+$zone,	# Top limit of the finished bar
					    -lmzn => 9+$zone,	# Bottom limit of the finished bar
					    -zone => 3+$zone,	# Bars size
					    -quzn => 0,		# Space destinated for legend
					    -ofwt => 0.5,	# Bars width
					    -fnsz => 9,		# Font size
					    -text => ''
					    ); # umzn +, lmzn +, zone +7

		# Assigns a barcode to $gfx
		my $scale = ($labelConfig{'labelWidth'}-2)/$barcode->width();
		$gfx->formimage($barcode, $x, $y, $scale);
		# Assigns the additional information to the barcode (Legend)
		if ($text_under_label) {
		    my @lines = split("\n",$text_under_label);
		    $title = $lines[0];
		    $author = $lines[1];
		}
		while ($text->advancewidth($title) > ($labelConfig{'labelWidth'} - 2))
{
		    chop $title;
		}
		while ($text->advancewidth($author) > ($labelConfig{'labelWidth'} -
2)) {
		    chop $author;
		}

		my ($x_adjust_1, $x_adjust_2, $y_adjust) = (0, 0, 0);
		if ($text->advancewidth($title) < ($labelConfig{'labelWidth'} - 5)) {
		    $x_adjust_1 = (($labelConfig{'labelWidth'} - 2) -
$text->advancewidth($title)) / 2;
		}
		if ($text->advancewidth($author) < ($labelConfig{'labelWidth'} - 5)) {
		    $x_adjust_2 = (($labelConfig{'labelWidth'} - 2) -
$text->advancewidth($author)) / 2;
		}
		$y_adjust = ($labelConfig{'labelHeigth'} - $barcode->height - 18) / 2;
		$y_adjust = 5 if ($y_adjust < 0);
		$y_adjust += $barcode->height;

		$text->translate($x + $x_adjust_1, $y + $y_adjust + 9);
		$text->text($title);
		$text->translate($x + $x_adjust_2, $y + $y_adjust);
		$text->text($author);

-------------  CUT  --------------

Hope that helps.

  



Assunto:
SPAM- [Koha-devel] Problems with barcode generation
De:
Pedro Faria <address@hidden>
Data:
Wed, 23 Aug 2006 18:10:09 +0100
Para:
koha_mailing_list <address@hidden>, address@hidden
Para:
koha_mailing_list <address@hidden>, address@hidden
CC:

Dear all,f - Numéro d'inventaire
Want to thank Henri-Damien LAURENT to fabulous help!
Now I am trying to generate barcodes.
First I wanna know if "Inventory code" asked  to generate the barcode is the same that we enter when adding an item (f - Numéro d'inventaire in additem.pl)? Because I give the same number (1000) and it says that there was any with that code (using Individual Codes in generator). If I select Continuous Range of Items from 0 to 1000 it proceeds...A bit odd :). Any ideas?

However it still was not ok. First I had to change some scripts becouse PDF::API2 has changed a bit and things are not anymore in the same place (e.g PDF::API::Utils is now PDF::API2::Basic::PDF::Utils). This I figured out myself. But now I got

Can't locate object method "barcode" via package "PDF::API2::Content" at /usr/local/koha/intranet/cgi-bin/barcodes/barcodesGenerator.pl line 259

and this one I still couldn't solve. Anyone can help?


_______________________________________________
Koha-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/koha-devel

_______________________________________________ Koha-devel mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/koha-devel
thax for aswering. Can you attach the full barcodeGenerator.pl? This piece of code should replace the code under continuous generation 'if' and the correspondant 'else'?
--- Begin Message --- Subject: Re: [Koha-devel] Problems with barcode generation Date: Thu, 24 Aug 2006 09:58:58 +0100 User-agent: Thunderbird 1.5.0.4 (X11/20060614)
Michael Hafen escreveu:
I had the same problem.  To get the barcodes I had to use a different
function entirely.

I've actually made a lot of changes to this script, but I will post the
relevant bit for your benefit.

-------------  CUT  --------------

		my $zone = length($code) - 5;
		my $barcode = $pdf->xo_3of9(-font => $tr,	# The font object to use
					    -code => $code, # Text to codify
					    -ext  => 1,		# extended character set
					    -extn => '012345',	# Barcode extension (if it is aplicable)
					    -umzn => 9+$zone,	# Top limit of the finished bar
					    -lmzn => 9+$zone,	# Bottom limit of the finished bar
					    -zone => 3+$zone,	# Bars size
					    -quzn => 0,		# Space destinated for legend
					    -ofwt => 0.5,	# Bars width
					    -fnsz => 9,		# Font size
					    -text => ''
					    ); # umzn +, lmzn +, zone +7

		# Assigns a barcode to $gfx
		my $scale = ($labelConfig{'labelWidth'}-2)/$barcode->width();
		$gfx->formimage($barcode, $x, $y, $scale);
		# Assigns the additional information to the barcode (Legend)
		if ($text_under_label) {
		    my @lines = split("\n",$text_under_label);
		    $title = $lines[0];
		    $author = $lines[1];
		}
		while ($text->advancewidth($title) > ($labelConfig{'labelWidth'} - 2))
{
		    chop $title;
		}
		while ($text->advancewidth($author) > ($labelConfig{'labelWidth'} -
2)) {
		    chop $author;
		}

		my ($x_adjust_1, $x_adjust_2, $y_adjust) = (0, 0, 0);
		if ($text->advancewidth($title) < ($labelConfig{'labelWidth'} - 5)) {
		    $x_adjust_1 = (($labelConfig{'labelWidth'} - 2) -
$text->advancewidth($title)) / 2;
		}
		if ($text->advancewidth($author) < ($labelConfig{'labelWidth'} - 5)) {
		    $x_adjust_2 = (($labelConfig{'labelWidth'} - 2) -
$text->advancewidth($author)) / 2;
		}
		$y_adjust = ($labelConfig{'labelHeigth'} - $barcode->height - 18) / 2;
		$y_adjust = 5 if ($y_adjust < 0);
		$y_adjust += $barcode->height;

		$text->translate($x + $x_adjust_1, $y + $y_adjust + 9);
		$text->text($title);
		$text->translate($x + $x_adjust_2, $y + $y_adjust);
		$text->text($author);

-------------  CUT  --------------

Hope that helps.

  



Assunto:
SPAM- [Koha-devel] Problems with barcode generation
De:
Pedro Faria <address@hidden>
Data:
Wed, 23 Aug 2006 18:10:09 +0100
Para:
koha_mailing_list <address@hidden>, address@hidden
Para:
koha_mailing_list <address@hidden>, address@hidden
CC:

Dear all,f - Numéro d'inventaire
Want to thank Henri-Damien LAURENT to fabulous help!
Now I am trying to generate barcodes.
First I wanna know if "Inventory code" asked  to generate the barcode is the same that we enter when adding an item (f - Numéro d'inventaire in additem.pl)? Because I give the same number (1000) and it says that there was any with that code (using Individual Codes in generator). If I select Continuous Range of Items from 0 to 1000 it proceeds...A bit odd :). Any ideas?

However it still was not ok. First I had to change some scripts becouse PDF::API2 has changed a bit and things are not anymore in the same place (e.g PDF::API::Utils is now PDF::API2::Basic::PDF::Utils). This I figured out myself. But now I got

Can't locate object method "barcode" via package "PDF::API2::Content" at /usr/local/koha/intranet/cgi-bin/barcodes/barcodesGenerator.pl line 259

and this one I still couldn't solve. Anyone can help?


_______________________________________________
Koha-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/koha-devel

_______________________________________________ Koha-devel mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/koha-devel
thax for aswering. Can you attach the full barcodeGenerator.pl? This piece of code should replace the code under continuous generation 'if' and the correspondant 'else'?

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]