Closed dadoprom closed 8 years ago
Whoa, I wasn't expecting any users, but awesome!
As you can probably guess by the error, I haven't really tested on arbitrary SVGs yet, I mainly use SVGs designed in InkScape. It looks like the code which extracts raw text from text elements might be overly strict. I'll fix that.
It might also be helpful to link to your template (if possible), a lot of it depends on the input file.
Well, I was looking for something like this for loooong time... I would be for sure 100perc happy if it works :). I made a template using inkscape based on your template. As you can see I also tested with your test files and it did not work. I have couple questioins: What file type as output file. Pdf? Svg? Could not find it in the readme. Also would it not be a better solution to have the configurations in separate file, lets say text file or csv or ini... It is just a tought :) Maybe not, maybe it is better in svg. I attached zip file with my custom files. kp.tar.gz
The output file is a SVG (this makes the code super simple, which just does transformations on a SVG tree, instead of needing a rendering engine). Existing applications can convert SVG to your final desired format, like PDF.
There's definitely a good argument for having configurations in a separate file, one being that the same sized labels are available in different sheet sizes (for example, I could get 1.75" x 0.5" labels in either 4" x 6" or US Letter sheets). But that's perhaps future work.
The test code here in this repo is kind of out of date, as is the README (I'll update that now). See this repository (actually the primary driving application) for templates that (should!) work: https://github.com/ucb-supernode/labels
Your template should now work fine, but you need to update the configuration style:
#config incx=40mm incy=10mm nrows=8 ncols=4
(it's now parsed as a standard command, rather than a special construct)
Thank you very much. Now everything appears to work except there is no generated file... I cant find it nowhere :) This is my command: python3 ./annotators.py kp/kp-lepky-A4.svg kp/kp-lepky-A4.csv kp/test.svg
also tried
python ./annotators.py kp/kp-lepky-A4.svg kp/kp-lepky-A4.csv kp/test.svg and python3 annotators.py kp/kp-lepky-A4.svg kp/kp-lepky-A4.csv kp/test.svg
what am I doing wrong?
I linked the ucb-supernode/labels repository for the example templates (in templates/
under the repository root). It submodules this repository (for the actual label generation code) and only contains code for generating the .csv
datasets programatically (fetching information from DigiKey and refomatting it for label printing). Because of the complexity, it's designed to be used with the included build scripts. But unless you're actually setting up electronics parts drawers, you probably won't have much use for much of the stuff in that repository except for seeing how the templates are done.
You should continue to use the ducky64/labelmaker repository (which contains actual code) and the original invocation syntax:
python labelmaker.py <input SVG> <input CSV> <output SVG>
YES!!! It works! Thank you very much... I have big smile for you.
When do you plan to implement newpage support? That is much needed :)
Probably soon, I'm not sure when exactly.
In the meantime, I've worked around it by either setting ncols / nrows to something ridiculously large and moving labels to a new page in Inkscape or by making the input CSVs small enough. Not elegant, of course, but it gets the job done..
Could be soon :) like very soon :D Anyway, thank you again.
This is what it doeas with test files: python labelmaker.py tests/testtemplate.svg tests/testdata.csv tests/vysledok.svg Traceback (most recent call last): File "labelmaker.py", line 62, in
StyleFilter()])
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 263, in init
raise TemplateError("No config command found")
SvgTemplate.TemplateError: No config command found
This is what it doeas with my test svg files: python labelmaker.py kp/kp-lepky-A4.svg kp/kp-lepky-A4.csv output.svg Traceback (most recent call last): File "labelmaker.py", line 62, in
StyleFilter()])
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 260, in init
config_parse(self.base_etree.getroot())
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 254, in config_parse
if config_parse(child):
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 254, in config_parse
if config_parse(child):
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 244, in config_parse
text = get_text_contents(elt)
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 33, in get_text_contents
process_child(elt)
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 32, in process_child
process_child(child_child_elt)
File "/home/dadoprom/Stiahnuté/apky/labelmaker-master/SvgTemplate.py", line 28, in process_child
raise NotImplementedError("get_text_contents only supports tspan children, got '%s'" % strip_tag(child_elt.tag))
NotImplementedError: get_text_contents only supports tspan children, got 'title'