Message-ID: <44ED6A52.6000605@eurotux.com>
Date: Thu, 24 Aug 2006 09:58:58 +0100
From: Pedro Faria <pjf@eurotux.com>
User-Agent: Thunderbird 1.5.0.4 (X11/20060614)
MIME-Version: 1.0
To: mdhafen@x.washk12.org
Subject: Re: [Koha-devel] Problems with barcode generation
References: <44EC8BF1.8040705@eurotux.com>
	<1156374138.5926.9.camel@localhost.localdomain>
In-Reply-To: <1156374138.5926.9.camel@localhost.localdomain>
Content-Type: multipart/alternative;
	boundary="------------090400090404000804080103"

This is a multi-part message in MIME format.
--------------090400090404000804080103
Content-Type: text/plain; charset="iso-8859-1"; format="flowed"
Content-Transfer-Encoding: quoted-printable

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 =3D length($code) - 5;
> 		my $barcode =3D $pdf->xo_3of9(-font =3D> $tr,	# The font object to use
> 					    -code =3D> $code, # Text to codify
> 					    -ext  =3D> 1,		# extended character set
> 					    -extn =3D> '012345',	# Barcode extension (if it is aplicable)
> 					    -umzn =3D> 9+$zone,	# Top limit of the finished bar
> 					    -lmzn =3D> 9+$zone,	# Bottom limit of the finished bar
> 					    -zone =3D> 3+$zone,	# Bars size
> 					    -quzn =3D> 0,		# Space destinated for legend
> 					    -ofwt =3D> 0.5,	# Bars width
> 					    -fnsz =3D> 9,		# Font size
> 					    -text =3D> ''
> 					    ); # umzn +, lmzn +, zone +7
>
> 		# Assigns a barcode to $gfx
> 		my $scale =3D ($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 =3D split("\n",$text_under_label);
> 		    $title =3D $lines[0];
> 		    $author =3D $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) =3D (0, 0, 0);
> 		if ($text->advancewidth($title) < ($labelConfig{'labelWidth'} - 5)) {
> 		    $x_adjust_1 =3D (($labelConfig{'labelWidth'} - 2) -
> $text->advancewidth($title)) / 2;
> 		}
> 		if ($text->advancewidth($author) < ($labelConfig{'labelWidth'} - 5)) {
> 		    $x_adjust_2 =3D (($labelConfig{'labelWidth'} - 2) -
> $text->advancewidth($author)) / 2;
> 		}
> 		$y_adjust =3D ($labelConfig{'labelHeigth'} - $barcode->height - 18) / 2;
> 		$y_adjust =3D 5 if ($y_adjust < 0);
> 		$y_adjust +=3D $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.
>
>  =20
>
> ------------------------------------------------------------------------
>
> Assunto:
> SPAM- [Koha-devel] Problems with barcode generation
> De:
> Pedro Faria <pjf@eurotux.com>
> Data:
> Wed, 23 Aug 2006 18:10:09 +0100
> Para:
> koha_mailing_list <koha-devel@nongnu.org>, koha@lists.katipo.co.nz
>
> Para:
> koha_mailing_list <koha-devel@nongnu.org>, koha@lists.katipo.co.nz
> CC:
>
>
> Dear all,f - Num=E9ro 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=20
> is the same that we enter when adding an item (f - Num=E9ro d'inventaire =

> in additem.pl)? Because I give the same number (1000) and it says that=20
> there was any with that code (using Individual Codes in generator). If=20
> I select Continuous Range of Items from 0 to 1000 it proceeds...A bit=20
> odd :). Any ideas?
>
> However it still was not ok. First I had to change some scripts=20
> becouse PDF::API2 has changed a bit and things are not anymore in the=20
> same place (e.g PDF::API::Utils is now PDF::API2::Basic::PDF::Utils).=20
> This I figured out myself. But now I got
>
> Can't locate object method "barcode" via package "PDF::API2::Content"=20
> at /usr/local/koha/intranet/cgi-bin/barcodes/barcodesGenerator.pl line=20
> 259
>
> and this one I still couldn't solve. Anyone can help?
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/koha-devel
> ------------------------------------------------------------------------
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/koha-devel
>  =20
thax for aswering. Can you attach the full barcodeGenerator.pl? This=20
piece of code should replace the code under continuous generation 'if'=20
and the correspondant 'else'?

--------------090400090404000804080103
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Michael Hafen escreveu:
<blockquote cite="mid1156374138.5926.9.camel@localhost.localdomain"
 type="cite">
  <pre wrap="">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-&gt;xo_3of9(-font =&gt; $tr,	# The font object to use
					    -code =&gt; $code, # Text to codify
					    -ext  =&gt; 1,		# extended character set
					    -extn =&gt; '012345',	# Barcode extension (if it is aplicable)
					    -umzn =&gt; 9+$zone,	# Top limit of the finished bar
					    -lmzn =&gt; 9+$zone,	# Bottom limit of the finished bar
					    -zone =&gt; 3+$zone,	# Bars size
					    -quzn =&gt; 0,		# Space destinated for legend
					    -ofwt =&gt; 0.5,	# Bars width
					    -fnsz =&gt; 9,		# Font size
					    -text =&gt; ''
					    ); # umzn +, lmzn +, zone +7

		# Assigns a barcode to $gfx
		my $scale = ($labelConfig{'labelWidth'}-2)/$barcode-&gt;width();
		$gfx-&gt;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-&gt;advancewidth($title) &gt; ($labelConfig{'labelWidth'} - 2))
{
		    chop $title;
		}
		while ($text-&gt;advancewidth($author) &gt; ($labelConfig{'labelWidth'} -
2)) {
		    chop $author;
		}

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

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

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

Hope that helps.

  </pre>
  <br>
  <hr size="4" width="90%"><br>
  <table class="header-part1" border="0" cellpadding="0" cellspacing="0"
 width="100%">
    <tbody>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">Assunto:
        </div>
SPAM- [Koha-devel] Problems with barcode generation</td>
      </tr>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">De: </div>
Pedro Faria <a class="moz-txt-link-rfc2396E" href="mailto:pjf@eurotux.com">&lt;pjf@eurotux.com&gt;</a></td>
      </tr>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">Data: </div>
Wed, 23 Aug 2006 18:10:09 +0100</td>
      </tr>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">Para: </div>
koha_mailing_list <a class="moz-txt-link-rfc2396E" href="mailto:koha-devel@nongnu.org">&lt;koha-devel@nongnu.org&gt;</a>, <a class="moz-txt-link-abbreviated" href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a></td>
      </tr>
    </tbody>
  </table>
  <table class="header-part2" border="0" cellpadding="0" cellspacing="0"
 width="100%">
    <tbody>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">Para: </div>
koha_mailing_list <a class="moz-txt-link-rfc2396E" href="mailto:koha-devel@nongnu.org">&lt;koha-devel@nongnu.org&gt;</a>, <a class="moz-txt-link-abbreviated" href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a></td>
      </tr>
      <tr>
        <td>
        <div class="headerdisplayname" style="display: inline;">CC: </div>
        </td>
      </tr>
    </tbody>
  </table>
  <br>
Dear all,f - Num&eacute;ro d'inventaire
  <br>
Want to thank Henri-Damien LAURENT to fabulous help!
  <br>
Now I am trying to generate barcodes.
  <br>
First I wanna know if "Inventory code" asked&nbsp; to generate the barcode
is the same that we enter when adding an item (f - Num&eacute;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?
  <br>
  <br>
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
  <br>
  <br>
Can't locate object method "barcode" via package "PDF::API2::Content"
at /usr/local/koha/intranet/cgi-bin/barcodes/barcodesGenerator.pl line
259
  <br>
  <br>
and this one I still couldn't solve. Anyone can help?
  <br>
  <br>
  <br>
_______________________________________________
  <br>
Koha-devel mailing list
  <br>
<a class="moz-txt-link-abbreviated" href="mailto:Koha-devel@nongnu.org">Koha-devel@nongnu.org</a>
  <br>
<a class="moz-txt-link-freetext" href="http://lists.nongnu.org/mailman/listinfo/koha-devel">http://lists.nongnu.org/mailman/listinfo/koha-devel</a>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Koha-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Koha-devel@nongnu.org">Koha-devel@nongnu.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nongnu.org/mailman/listinfo/koha-devel">http://lists.nongnu.org/mailman/listinfo/koha-devel</a>
  </pre>
</blockquote>
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'?<br>
</body>
</html>

--------------090400090404000804080103--

