Changed offset option
This commit is contained in:
parent
5b09007939
commit
88b3d8952d
33
README.md
33
README.md
@ -11,21 +11,46 @@ Generate labels for printing using HTML rendering.
|
||||
|
||||
## Usage
|
||||
|
||||
The simplest use case is some static labels:
|
||||
The simplest use case is some static labels using a [template](examples/simple.html):
|
||||
|
||||
python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 > output.html
|
||||
|
||||
Then, when you need some more just pop the same sheet back in the printer and offset the start
|
||||
|
||||
python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 > output.html
|
||||
python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 -o 10 > output.html
|
||||
|
||||
To do some mail merge operations create a list of names:
|
||||
To do some mail merge operations create a [list of names](examples/names.txt):
|
||||
|
||||
Andy Andrews
|
||||
Bob Brown
|
||||
Charlie Chaplin
|
||||
|
||||
and use a `{data[text]}` element in your template. Note we've shifted to an external stylesheet now as well.
|
||||
and use a `{data[text]}` element in your [template](examples/name_tags.html). Note we've shifted to an [external stylesheet](examples/hello.css) now as well.
|
||||
|
||||
python -m pylabel -t examples/name_tags.html -p avery.L7157 -d examples/names.txt -s examples/hello.css > output.html
|
||||
|
||||
Full list of options `python -m pylabel -h`
|
||||
|
||||
usage: __main__.py [-h] [--count COUNT] [--offset OFFSET] [--profile PROFILE] [--template TEMPLATE] [--style STYLE] [--data DATA] [--json] [--logging LOGGING] [spec]
|
||||
|
||||
Generate a page of labels
|
||||
|
||||
positional arguments:
|
||||
spec Specification module
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--count COUNT, -c COUNT
|
||||
Number of labels to generate
|
||||
--offset OFFSET, -o OFFSET
|
||||
Skip first n labels
|
||||
--profile PROFILE, -p PROFILE
|
||||
Label profile
|
||||
--template TEMPLATE, -t TEMPLATE
|
||||
Template for label
|
||||
--style STYLE, -s STYLE
|
||||
Additional stylesheet
|
||||
--data DATA, -d DATA Pre-generated data, one entry per line
|
||||
--json, -j Parse data lines as json
|
||||
--logging LOGGING, -l LOGGING
|
||||
Logging level
|
||||
@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
|
||||
parser = argparse.ArgumentParser(description="Generate a page of labels")
|
||||
|
||||
parser.add_argument('--count', '-c', type=int, default=0, help="Number of labels to generate")
|
||||
parser.add_argument('--skip', '-n', type=int, default=0, help="Skip first n labels")
|
||||
parser.add_argument('--offset', '-o', type=int, default=0, help="Skip first n labels")
|
||||
parser.add_argument('--profile', '-p', help='Label profile')
|
||||
parser.add_argument('--template', '-t', type=argparse.FileType('r'), help='Template for label')
|
||||
parser.add_argument('--style', '-s', type=argparse.FileType('r'), help='Additional stylesheet')
|
||||
@ -77,4 +77,4 @@ for required in ('profile', 'template', 'data'):
|
||||
|
||||
sheet = LabelSheet(spec.profile)
|
||||
|
||||
sys.stdout.write(sheet.render_html(spec.template, spec.data, options.skip, getattr(spec, 'style', '')))
|
||||
sys.stdout.write(sheet.render_html(spec.template, spec.data, options.offset, getattr(spec, 'style', '')))
|
||||
Loading…
x
Reference in New Issue
Block a user