[Koha-devel] Barcodes Barcodes

Joshua Allen Holm joshua.holm at gmail.com
Mon Jun 20 20:35:17 CEST 2005


I haven't managed to get Barcodes to work 100% correctly but I have 
found a few things that may be helpful. Version 0.41 of PDF::API has a 
very different layout and a load of new/changed features when compared 
to the older 0.3r77 release. As you have already seen with 
PDF::API2::PDF::Utils.pm moving to PDF::API2::Basic::PDF::Utils.pm. 
PDF::API2.pm seems to no longer have a barcode method but it does have 
individual methods for different barcode types.

Changing 'barcode' on line 165 and line 237 of barcodesGenerator.pl to 
any one of the various barcode methods in PDF::API2.pm (xo_codabar, 
xo_code128, xo_2of5int, xo_3of9, or xo_ean13), makes the barcode 
generator sort of work. The problem is the barcodes printed using the 
default settings are massive and the top margin of the page is ignored. 
Only the second line of the title & author text label appears when I try 
to print a label on the first row of label numbers, everything else is 
cut off. If I try to print the barcode on the last row the first digit 
of the barcode takes up almost a third of the page.

If I revert back to the 0.3r77 release of PDF::API2 (and don't make any 
changes to koha's files, i.e. don't change PDF::API2::PDF::Utils to 
PDF::API2::Basic::PDF::Utils) the margin problem disappears (at least 
for the text label) but the barcodes are still way too big. If I change 
the DPI setting the something massive like 5760 the barcode starts to 
approach a normal size. If I use an install of Perl 5.6 (instead of the 
5.8 install I normally use) with PDF::API2 0.3r77, the pdf generated has 
the same problems as the one using PDF::API2 0.3r77 on Perl 5.8 only now 
Acrobat Reader complains that the PDF generated is corrupt and cannot be 
repaired, but only when the pdf is automatically opened after clicking 
"generate barcodes". If I open the PDF file from the tmp directory it 
opens just fine.

A zip file containing a collection of PDFs generated by a few of the 
various things I have tried is available at 
http://students.lisp.wayne.edu/~ar0633/koha_barcodes.zip
the file names should (hopefully) be self explanatory.

My Koha install is a bit wonky; I manually installed Koha on Windows XP 
to test out/play with so there is a slim possibility that there is 
something wrong on my end for some of the problems. On the topic of Koha 
on Windows, I would like to point out that barcodesGenerator.pl, on line 
133 uses colons in the file name it creates to save the barcode pdf 
file. This obviously does not work on Windows and should probably be 
changed to something else (I simply changed the colons to periods).

Hope this helps,

--
Joshua Allen Holm, MLIS
joshua.holm at gmail.com

Joshua Ferraro wrote:
> Hi all,
> 
> I attempted to get the barcode generation going this afternoon
> and failed. My problems started with the error everyone else
> has reported:
> Can't locate PDF/API2/PDF/Utils.pm in @INC
> 
> I found that Fedora was having trouble installing PDF::API2 (but
> it was not giving any useful errors). So I installed the Fedora
> package for PDF::API2's one major dependency: Compress::Zlib (the
> package name is perl-Compress-Zlib). After that installed I was
> able to install PDF::API2. But I still got the same error and I
> noticed the following:
> 
> /usr/lib/perl5/site_perl/5.8.5/PDF/API2/Basic/PDF/Utils.pm
> 
> I replaced use PDF::API2::PDF::Utils; with PDF::API2::Basic::PDF::Utils;
> in barcodesGenerator.pl and printerConfig.pl.
> 
> Now I'm getting:
> Can't locate object method "barcode" via package "PDF::API2" at /home/koha001/koha/intranet/cgi-bin/barcodes/barcodesGenerator.pl line 239
> 
> I don't see a barcode method anywhere on CPAN for the PDF::API2
> modules. Is there another library that has this method?
> 
> Has anyone use the barcode generation successfully? Any tips for
> getting it going?
> 
> Thanks,
> 




More information about the Koha-devel mailing list