Bug 23654

Summary: Patron Cards - Bar code and image do not show up
Product: Koha Reporter: Rick Conrad <rick_conrad>
Component: Label/patron card printingAssignee: Chris Nighswonger <cnighswonger>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook
Version: 19.05   
Hardware: Other   
OS: Linux   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: The pdf generated
Screenshot of layout settings
Screenshot of template settings

Description Rick Conrad 2019-09-20 10:56:06 UTC
Created attachment 92993 [details]
The pdf generated

When I generate a pdf of patron cards, I see the text that was specified, but there's no bar code and there's no image displayed.

Server info from the About Page:
````
Server information
Koha version:	19.05.03.000
OS version ('uname -a'):	Linux koha 4.15.0-64-generic #73-Ubuntu SMP Thu Sep 12 13:16:13 UTC 2019 x86_64
Perl interpreter:	/usr/bin/perl
Perl version:	5.026001
Perl @INC:	/usr/share/koha/lib 
/usr/share/koha/installer 
/usr/share/koha/lib/installer 
/etc/perl 
/usr/local/lib/x86_64-linux-gnu/perl/5.26.1 
/usr/local/share/perl/5.26.1 
/usr/lib/x86_64-linux-gnu/perl5/5.26 
/usr/share/perl5 
/usr/lib/x86_64-linux-gnu/perl/5.26 
/usr/share/perl/5.26 
/usr/local/lib/site_perl 
/usr/lib/x86_64-linux-gnu/perl-base 
/var/lib/koha/library/plugins 
MySQL version:	mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper
Apache version:	Server version: Apache/2.4.29 (Ubuntu)
PSGI:	Plack (deployment)
Memcached:	Servers: localhost:11211 | Namespace: koha | Status: running. | Config read from: koha-conf.xml
Zebra version:	Zebra 2.0.59 (C) 1994-2014, Index Data Zebra is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. SHA1 ID: c00bfddbf0f3608340d61298acc61dafb167f9b2 Using ICU
Date and time:	20/09/2019 10:43
Time zone:	Used: UTC | Config: Undefined | Environment (TZ): Undefined
````

On the Perl Modules tab, the following module are red - not installed. Don't know if maybe I need one of them.
````
Text::CSV::Unicode
Selenium::Remote::Driver
Test::DBIx::Class
Net::OAuth2::AuthorizationServer
HTTPD::Bench::ApacheBench
````

Here's the parameters for the layout:
````
mysql> select * from creator_layouts where layout_id=8;
+-----------+--------------+-------------+---------------+-------------+----------+---------------+------+-----------+-------+---------------+--------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
| layout_id | barcode_type | start_label | printing_type | layout_name | guidebox | oblique_title | font | font_size | units | callnum_split | text_justify | format_string | layout_xml                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | creator     |
+-----------+--------------+-------------+---------------+-------------+----------+---------------+------+-----------+-------+---------------+--------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
|         8 | CODE39       |           1 | BAR           | koha2       |        0 |             1 | TR   |        10 | INCH  |             0 | L            | barcode       | <opt guide_box="0" guide_grid="0" page_side="F" units="INCH">
  <barcode height_scale="0.5" llx="1.4" lly="0.1" print="1" type="CODE39" width_scale="0.5" />
  <images name="image_1" Dx="1" Ox="0" Oy="0" Sx="0" Sy="0" Tx="0.1" Ty="0.1">
    <data_source image_name="SIL Logo New" image_source="creator_images" />
  </images>
  <text>&lt;surname&gt;, &lt;firstname&gt;</text>
  <text enable="1" font="CB" font_size="14" llx="0.1" lly="1.7" text_alignment="L" />
  <text>Library Card/Carte de Bibliotheque</text>
  <text enable="1" font="C" font_size="10" llx="0.1" lly="1.45" text_alignment="L" />
  <text>10/09/2020</text>
  <text font="CB" font_size="10" llx="0.1" lly="1.2" text_alignment="L" />
</opt>
 | Patroncards |
+-----------+--------------+-------------+---------------+-------------+----------+---------------+------+-----------+-------+---------------+--------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
1 row in set (0.00 sec)
````

And for the template:
````
mysql> select * from creator_templates where template_id=6;
+-------------+------------+---------------+------------------+------------+-------------+-------------+--------------+-----------------+------------------+------------+-------------+------+------+---------+---------+-------+-------------+
| template_id | profile_id | template_code | template_desc    | page_width | page_height | label_width | label_height | top_text_margin | left_text_margin | top_margin | left_margin | cols | rows | col_gap | row_gap | units | creator     |
+-------------+------------+---------------+------------------+------------+-------------+-------------+--------------+-----------------+------------------+------------+-------------+------+------+---------+---------+-------+-------------+
|           6 |          0 | Good Template | This one is good |        8.3 |        11.7 |         3.5 |            2 |               0 |                0 |     0.6785 |         0.5 |    2 |    4 |     0.2 |     0.2 | INCH  | Patroncards |
+-------------+------------+---------------+------------------+------------+-------------+-------------+--------------+-----------------+------------------+------------+-------------+------+------+---------+---------+-------+-------------+
1 row in set (0.00 sec)
````

The resulting pdf is attached.

Thanks in advance for your help!
Comment 1 Rick Conrad 2019-09-20 12:14:25 UTC
Created attachment 92996 [details]
Screenshot of layout settings
Comment 2 Rick Conrad 2019-09-20 12:15:27 UTC
Created attachment 92997 [details]
Screenshot of template settings
Comment 3 Katrin Fischer 2019-09-22 11:15:44 UTC
Hi Rick, with questions like this that could be about configuration, it's good to hit the mailing list first as many more people will be reading your problem there and be able to offer help from their experience. I'll leave this open as a bug, but if you figure out a solution, please remember to close it.
Comment 4 David Cook 2019-10-02 02:29:28 UTC
I've been experiencing some problems with patron cards in an older version of Koha, and I think maybe our problems are linked.

It's difficult to explain. 

With the Template, there is Page height/width and Card height/width. 

When I am creating a Layout, I expect the top of my Y axis to be the top of the Card height.

However, the top of my Y axis seems to actually be the top of my Page height (minus the top page margin). Yet, when the label batch is exported, the layout seems relative to the Card and not the Page.

I'm specifying a Lower left Y coordinate of 274mm but that's actually placing the text at the Lower left Y coordinate of about 44mm on the card. 

I'm sure my explanation makes no sense, but basically... I think there is something very wrong with the patron card creator - at least when using SI Millimeters for both the Template and Layout...

If you set all your X/Y coordinates to 0 and then move incrementally from there, I think you'll see what I mean.
Comment 5 David Cook 2019-10-02 02:30:27 UTC
Haven't looked at the code yet myself as I have a number of other priorities.

Plus I have a feeling that the fix will actually break a lot of existing layouts...
Comment 6 David Cook 2019-10-02 02:35:28 UTC
Actually, after I changed my Images data that's caused the X/Y axis for my Text fields to completely change. 

I'd say there's a number of factors regarding units that are wrong here...
Comment 7 Chris Nighswonger 2019-10-02 22:18:34 UTC
(In reply to David Cook from comment #6)
> Actually, after I changed my Images data that's caused the X/Y axis for my
> Text fields to completely change. 
> 
> I'd say there's a number of factors regarding units that are wrong here...

Just FTR:

1. A lot of code has run off of the keyboard since I wrote this stuff over nine years ago, so there may be changes I'm unaware of and resulting bugs.

2. There may indeed be something buggy about the unit conversion code that I originally wrote. The library I did the work for uses Imperial units and that was my focus. I would definitely check there first. Everything is converted to post script points.

3. The fundamental coordinate system is taken from the PDF ISO 32000-1 standard published by Adobe and has its origin at the lower left corner of the page. In other terms, the page is the first quadrant of the Cartesian Coordinate system.

I'd look at the unit conversion code first to see if there's something going on there. Beyond that, I'm not sure what to suggest as it still works in the library here.
Comment 8 David Cook 2019-10-03 00:09:12 UTC
(In reply to Chris Nighswonger from comment #7)
> 
> I'd look at the unit conversion code first to see if there's something going
> on there. Beyond that, I'm not sure what to suggest as it still works in the
> library here.

Yeah, I think I probably won't work on this, as I just did a workaround to get the cards to display as desired. I don't have a lot of libraries using patron cards, especially with images, so not too much of a priority over here.