Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Avery 5160 Label Report

Help
2009-04-02
2013-05-30
  • I had searched around for someone who had already done this but had limited success. A found a good example using fpdf, but I wanted to try to use what was built into openbiblio. I decided to tinker and here is what I came up with. The skip labels offset works correctly. Feel free to use. Any questions please email me volpe.anthony@gmail.com. Hope this helps someone.

    To use: Simple past this code over the existing code in labels.php which is found under layouts -> default -> labels.php.

    <?php
    /* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
    * See the file COPYRIGHT.html for more details.
    */

    require_once('../classes/Lay.php');

    class Layout_labels {
        var $p;
       
        function paramDefs() {
            return array(array('string', 'skip', array('title'=>'Skip Labels', 'default'=>'0')),);
        }

        function init($params) {
            $this->p = $params;
        }

        function render($rpt) {
            $lay = new Lay('Letter');
            $lay->container('Columns', array('margin-top'=>'0.5in', 'margin-bottom'=>'0.5in','margin-left'=>'0.1875in', 'margin-right'=>'0.1875in',));

            list(, $skip) = $this->p->getFirst('skip');

            $ncell = 0;
            $nlabelcount = $rpt->count() + $skip;
            $ncolcount = 3;
            $nrowcount = intval($nlabelcount / $ncolcount);
            if ($nlabelcount % $ncolcount) $nrowcount++;

            for ($nrow = 1; $nrow <= $nrowcount; $nrow++){
               
                $lay->container('Line', array('height'=>'1.0in', 'width'=>'8.0930in',));
               
                for ($ncol = 1; $ncol <= $ncolcount; $ncol++){
                   
                    $lay->container('Column', array('width'=>'2.5935in', 'y-spacing'=>'1mm', 'y-align'=>'center'));

                        if ($skip == 0 and $ncell != $nlabelcount){
                           
                            $ncell++;
                            $row = $rpt->each();   
                       
                            $lay->container('TextLine', array('x-align'=>'center'));
                                $lay->pushFont('Code39JK', 20);
                                    $lay->text('*'.strtoupper($row['barcode_nmbr']).'*');
                                $lay->popFont();
                            $lay->close();
       
                            $lay->container('TextLine', array('x-align'=>'center'));
                                $lay->pushFont('Courier', 9);
                                    $lay->text(strtoupper($row['barcode_nmbr']));
                                $lay->popFont();
                            $lay->close();
       
                            $lay->container('TextLine', array('x-align'=>'center'));
                                $lay->pushFont('Courier', 9);
                                    $lay->text($row['title']);
                                $lay->popFont();
                            $lay->close();
       
                            $lay->container('TextLine', array('x-align'=>'center'));
                                $lay->pushFont('Courier', 9);
                                    $lay->text($row['author']);
                                $lay->popFont();
                            $lay->close();
       
                            $lay->container('TextLine', array('x-align'=>'center'));
                                $lay->pushFont('Courier', 6);
                                    $lay->text("Property of Assumption Regional Catholic School".$nrowcount);
                                $lay->popFont();
                            $lay->close();
                        }
                        else
                            $skip--;
                       
                    $lay->close();
                   
                    if ($ncol != $ncolcount){
                        $lay->container('Column', array('width'=>'0.15625in', 'y-align'=>'center'));
                        $lay->close();               
                    }
               
                }
                   
                $lay->close();

               
            }
           
            $lay->close(); //Close Line Container

            $lay->close(); //Close Page Container
       
        } //End of Render Function

    }

    ?>

     
  • schalldp
    schalldp
    2009-12-02

    I'm very interested in how you did this. I need OpenBiblio to print information to standard Demco 14216850 library label sheets. I know enough PHP to be dangerous, but not enough to be called a developer! I assume that it's possible to modify layout.php to print to any label template you need. Is that right? The Demco sheets have three labels per section, a spine label and two other. Can OpenBiblio do this with the right mods?

     
  • For version 0.6.x and higher you only have to make a new file  /openbiblio/layouts/labels.php and add instructions how to format the label. This way your custom label is preserved when OpenBiblio is updated.

    I'm not familiar with the Demco labels, but perhaps they are similar to the default label for OpenBiblio (openbiblio/layouts/default/labels.php).
    Physical dimensions are A4 1x16 (Avery L7674), but OpenBiblio formats it as a multilabel with three sections:

    1. Call number
    2. Barcode
    3. Title, author, collection

    Keep an eye on this forum. Soon I will publish a package with lots of reports,  the latest update of the multilabel and more layouts for labels and member cards.

    Regards,

    Hans.

     
  • schalldp
    schalldp
    2009-12-03

    Thanks for the reply and for your latest custom labels file. I will see if I can figure out how it works. There isn't a tutorial somewhere on how to create custom labels is there? The label sheet that I need to print looks like this: . It's a standard library label sheet (in the US) and is supported by all the commercial library programs. I was hoping it wouldn't be too difficult to get OpenBiblio to print to it as well. Can you take a quick look at the link above and tell me if it would even be possible to do such a thing? It's two columns with three sub-labels in each section.

    David

      : http://www.demco.com/webprd_demco/product_block/D21/LS1421685LA_wd.gif

     


Anonymous


Cancel   Add attachments