Created attachment 38764 [details] [review] Bug 14107 - Patron cards: Make barcode width and height scaling editable The size of the barcode in patron card creator was hardcoded to 1% of the card height and 80% of the card width. This patch exposes both values in the layout editor. If no values are given, the previousely hard coded values (0.01 / 0.8) are used in order to work with existing card definitions. To test: - Go to Home > Tools > Patron card creator - Export a patron card (PDF) from en existing definition - Apply patch - Export patron card again, compare results (should be the same) - Go to Home > Tools > Patron card creator > Manage card layouts - Edit the layout you use for testing and set barcode scaling values e.g. to 0.03 for height and 0.4 for widht - Export patron card again, verify that barcode size changed
This needs to be tested with barcodes of less than 4 digits. The original problem with exposing scaling was that barcode shorter than ability about 5 digits behaved badly. At the time some libraries were starting numbering at 1.
Created attachment 38767 [details] Use case "Butterfly" Card Usecase "Butterfly" card. This type of card has a self adhesive part on a sheet of paper (e.g. an invoice) that can be detached and folded. See follwong attachments (Cards created without and with patch).
Created attachment 38768 [details] Output PDF without patch Butterfly card without patch.
Created attachment 38769 [details] OutputPDF with patch After applying the patch and adjusting the value for barcode width scaling.
C4/Patroncards/Patroncard.pm is modified. Is there a way to add tests?
Looks good to me. If it's not done before Monday, I'll be glad to sign-off on it.
(In reply to M. Tompsett from comment #6) > C4/Patroncards/Patroncard.pm is modified. Is there a way to add tests? Changing the values has a visual impact on the PDF, I do not know how this could be tested.
Created attachment 38829 [details] new barcode scaling options in patron card creator menue The enhancement provided by mveron allows scaling the barcode both in horizontal and vertical direction. The scaling values in the menue are preset with the values that produce the same result as before the the enhancement.
koha manual chapter 3.1.6 on patron card creator needs to be adapted to include the new barcode scaling options
Marc, would it be possible for you to add this to the label tool as well?
Created attachment 38848 [details] [review] [SIGNED OFF] Bug 14107: Patron cards: Make barcode width and height scaling editable The size of the barcode in patron card creator was hardcoded to 1% of the card height and 80% of the card width. This patch exposes both values in the layout editor. If no values are given, the previousely hard coded values (0.01 / 0.8) are used in order to work with existing card definitions. To test: - Go to Home > Tools > Patron card creator - Export a patron card (PDF) from en existing definition - Apply patch - Export patron card again, compare results (should be the same) - Go to Home > Tools > Patron card creator > Manage card layouts - Edit the layout you use for testing and set barcode scaling values e.g. to 0.03 for height and 0.4 for widht - Export patron card again, verify that barcode size changed Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
(In reply to Chris Nighswonger from comment #11) > Marc, would it be possible for you to add this to the label tool as well? Chris, I think so. Can you open a separate Bug for the label tool and put me on the cc?
I have done a little bit black box analysis: how does the bar code behave under different sized labels/cards. The analysis is done with 3.18.5, hence without this patch or any other modification. 1. The bar code position defines the position of the lower left corner of the bar code string (as designed). The bar code includes a little bit of white lead space, approximately half a code character.Therefore the first black bar of the bar code is found that amount to the right of the defined start position. 2.The length of the bar code string including white lead and trailing space is approximately 75% of the label width. if this observed length is associated with a value 0.8 some extra space is included in the calculation. 3. The lower left position defined is the baseline of the human readable string. If that string is not printed the height reserved for the human readable string is left blank. 4. the height of human readable string + the bar code is about 27% of the label/card height. The bar code alone is 20% of the label/card height. If these values are associated with an internal scale 0.01 I do not know to which basis this scale is chosen. 14 digits + start char + stop char were measured 49 mm long 7mm high on a template with label/cards 70*36mm close to credit card size 85*54mm. Aspect ratio of bar code letters h/w hence was 7/3 w~0.5*h. Unfortunately the bar code is the only element of the layout that reacts to the size of the label/card. All text and pictures remain same size and position (with respect to lower left corner) with disregard to the size of the label/card I think it is desirable to have a consistent and foreseeable behaviour. May I suggest to think about giving the barcode a height in chosen units and define its (estimated) length from the number of characters in string * character width (derived from height * aspect factor 0,5). It is then the users responsibility to choose a barcode height in the layout which results an acceptable string length not exceeding the available space on the label/card.
The problem with this is that PDF::Barcode does some internal scaling on the image depending on the length of the number, etc. So one ends up chasing ones tail so to speak. The currently proposed solution avoids this effect for the most part.
Created attachment 40764 [details] [review] Bug 14107: Patron cards: Make barcode width and height scaling editable The size of the barcode in patron card creator was hardcoded to 1% of the card height and 80% of the card width. This patch exposes both values in the layout editor. If no values are given, the previousely hard coded values (0.01 / 0.8) are used in order to work with existing card definitions. To test: - Go to Home > Tools > Patron card creator - Export a patron card (PDF) from en existing definition - Apply patch - Export patron card again, compare results (should be the same) - Go to Home > Tools > Patron card creator > Manage card layouts - Edit the layout you use for testing and set barcode scaling values e.g. to 0.03 for height and 0.4 for widht - Export patron card again, verify that barcode size changed Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu> Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Patch pushed to master. Thanks Marc!
*** Bug 9480 has been marked as a duplicate of this bug. ***