gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnue-dev] GNUe Reports and Label Stock


From: Jason Cater
Subject: [Gnue-dev] GNUe Reports and Label Stock
Date: Wed, 13 Nov 2002 18:02:06 -0600

Greetings, my GNUe friends.

I'm posting this new working example as many of you aren't aware of the
status of GNUe Reports.  This is the latest addition to its bag of
tricks and is a simple way to become familiar with the Reports paradigm.

For a project at work, I have implemented a "Label" filter for GNUe
Reports -- a filter for generating address labels. Basically, you can
define a very simple GRD (reports definition) using the
GNUe:Reports:Labels namespace, and have that file generate labels on a
variety of label stock, all referencable by brand name.

In other words, you can define a label report mockup, and have output
automatically formatted for "Avery 5961", "Avery 6879", and a variety
of other label stocks.

The syntax of the "label" mode command line is:

$ gnue-reports -f postscript -F 'label="<label name>"' \
               -D printer -d <printername> <report name>

The "-f postscript" part says we are outputting Postscript.  -F
specifies the filter-specific options.  In our case, we are primarily
concerned with label=, which specifies the label name.  For example, to
print on Avery 6879, you would pass 'label="Avery 6879"'.  "-D printer"
sends this to a printer (as opposed to -D email, -D file, or -D fax) 
and -d specifies the printer name.


The result of:

  ~/bin/grcvs -f postscript -F 'label="Avery 5161"' \
              -d labels.ps cvs/gnue/reports/samples/labels/labels.grd

is at:

  http://www.gnuenterprise.org/~jcater/labels.pdf

Right now, only Postscript output has been added.  Soon, PCL, Epson
dot-matrix (ESC/P), and plain line-printer modes will be added. Most
printers these days have emulation for at least one of these modes, so I
doubt I will add many other drivers.  Also, ghostscript is so advanced
these days, most printers can be supported with a simple Postscript
output.

However, anyone with even slight programming experience can add their
own, custom printer driver.

Working example (this is in gnue's reports/samples/labels directory)

My table looks like:

             Table "addresses"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 name   | character varying(40) |
 add1   | character varying(40) |
 add2   | character varying(40) |
 city   | character varying(25) |
 state  | character varying(2)  |
 zip    | character varying(5)  |


My report looks like:

---------------------
<?xml version="1.0"?>

<report>

  <sources>
    <datasource database="gnue" name="dtsAddresses" table="addresses"/>
  </sources>

  <layout xmlns:out="GNUe:Reports:Labels">
    <out:labels>

    <section source="dtsAddresses">
      <out:label>
        <out:region name="primary">
          <out:line emphasize="Y"><field name="name"/></out:line>
          <out:line><field name="add1"/></out:line>
          <out:line suppressEmpty="Y"><field name="add2"/></out:line>
          <out:line><field name="city"/>, <field name="state"/> <field
name="zip"/></out:line>
        </out:region>
      </out:label>
    </section>

    </out:labels>

  </layout>
</report>
---------------------

Basically, you would just need to modify the datasource, and add or
remove however many <out:line> sections as you need. Those correspond to
lines on the label. As with all reports, <field name="city"> inserts the
value of the database field "city".

<out:line> supports two attributes; namely:

  <out:line emphasize="Y">      Emphasis this line (usually, bold)
  <out:line suppressEmpty="Y">  If this line is empty, don't print a
blank.

This is currently only available in CVS, but will be in the upcoming
0.1.0 release.


-- Jason




reply via email to

[Prev in Thread] Current Thread [Next in Thread]