Bauble / bauble.classic

this is how Bauble and Ghini both started
GNU General Public License v2.0
10 stars 34 forks source link

Generating labels for an engraver #227

Closed RoDuth closed 8 years ago

RoDuth commented 8 years ago

Have been using printed labels for some time now and are looking to go to engraved plastic labels very soon. I have been speaking to the local engravers and would prefer to be able to use the reporting system to generate a file the engraver can use directly with his CNC engraver. I can proof it before sending it off to make sure everything looks right. No risk of human error. I can design the label styles I want and make the choice myself as to which accession gets which style etc. etc. Have been playing with the XSL formatter and the sample templates but have run into a couple of issues.

  1. The engravers have asked for an .eps file so I used pdftops with the -eps switch to convert from the .pdf output of the xsl formatter. Now he says he needs the fonts to be paths (vectors). I'm sure there is some way to get GIMP to do the paths part but cant work it out (haven't used GIMP in years) and keep thinking there must be an easier way with less manual steps.
  2. He wants it to be 1 label at a time, not sure whether this means per file or page within the file?? (do .eps files have pages?) The extent of my playing with the style sheet is just swapping things around so I don't really know what I'm doing here.
  3. Due to the fact the style sheets use the ABCD FullScientificNameString I have no control of the formatting in regards to italics etc.

Would be nice to power our own CNC engraver straight from the database one day. (open source hardware maybe?)

Any ideas?

mfrasca commented 8 years ago

@HubelSB aquí se habla de hardware “our own CNC engraver”, me parece le pueda interesar! :fire: http://www.instructables.com/id/Arduino-Laser-Engraver/ ?

RoDuth commented 8 years ago

That's it!! Been toying with the idea of an Arduino project for a while now...

mfrasca commented 8 years ago

an other idea is that eps files are just text files, so if we would have just a couple of valid files for your CNC engravers, producing just any label of the correct size and with the right fonts, then we might convert these files into a mako template. not a big deal, this last part.

RoDuth commented 8 years ago

Will this work? His concern was that they needed to be vector files not text files. (i.e. you needed to outline the text with paths to get a path for the engraver to follow). After the silly season is over I'll go speak to the engraver and get a better idea of exactly what he wants and the formats that he can work with. (didn't know mako could generate .eps files)

mfrasca commented 8 years ago

»PostScript (PS) is a computer language for creating vector graphics« wikipedia, so I guess yes it will work. your engraver will probably tell you that the eps files you passed him had raster fonts (he already told you »he needs the fonts to be paths«.) it's quite some time since I last played with postscript programs, I kind of recall there was a fonts definition part, a page definition part, then the placing of (groups of) letters on the page. can you put here one of your labels (in eps format, zipped), that your engraver refused?

RoDuth commented 8 years ago

@mfrasca see the attached example of what the engraver is looking for. They said it was hard to get their system to export an example of what they would like as input but this would be a format that they could take. The finished size is 120x70mm which I think is demarked by the red lines. (in case you are wondering NATIVE CQCB is the "Label distribution" field of the species) Label.pdf

mfrasca commented 8 years ago

nope. I can use a .ps file (it's an ascii thing and it is a program), I cannot look inside of a pdf (binary) file. if it is not possible for them, then too bad, but you should insist in PostScript format. or I should go back to studying postscript myself and produce one with the characteristics of the pdf you posted here. and with a vectorial font, which is what your engraver says they need.

RoDuth commented 8 years ago

Dang blasted proprietary systems! From what I gather they would prefer the post script as the input anyway. I just think that pdf was all they could generate as an output from their software.

I'll attach the .eps file I generated from a .pdf using pdftops -eps that they said was close to being usable, except for the fact that they only wanted 1 label at a time and the vector fonts. I generated the .pdf from an xsl template which I'll also add to the zip file. Don't laugh at my butchery of the original labels template!!

I just want to be able to generate a report that I can proof then send to the printers so they can print... Sounds so simple! So frustrating!

I'll speak to them again about the formats and see if they can give us something a little more usable.

Labels.zip

RoDuth commented 8 years ago

Just a thought but what about putting their .pdf through pdftops -eps? Surely that will work?

EPSLabel.zip

mfrasca commented 8 years ago

is this note relevant?

mfrasca commented 8 years ago

well, I think it's a bit complicated but doable. if I print from libreoffice a document that contains nothing more than all the letters you might want to ever use, using as font LiberationSerif, I get a ps where the glyphs are defined and numbered. ... then you have sequences of:

162 208 moveto
<0102030405060708090A0B0C0D0E0F101112131415161718191A>
[23 25 22 25 23 15 26 25 14 13 26 13 39 24 26 25 25 17 19 14 26 24 37 25 24 0]
xshow

where you first move to 162, 208, then show the gliphs 01-1A which have the widths as specified in the second parameter. it's almost RPN, like old HP calculators.

mfrasca commented 8 years ago

can you ask your engraver if they would be able to print this one? test.zip (if you do not like the font... we choose it later, let's first see if this is acceptable to the engraver.) (the postscript code here looks quite different than the eps you posted before)

mfrasca commented 8 years ago

pfffffffff you also want bold and italic! :scream: I don't know... it is possible to produce it programmatically directly from Mako, but it's quite a bit of preparation almost by hand. maybe there are tools to do this easier. however, once programmed, it would be very lightweight, no more dependencies than Mako itself. but one font.


having the sample, with your desired vector font, page size correctly set, and some text already in place, the task would be trivial. ... and no, transforming a pdf into postscript would not transform the raster pdf into a vector ps.

RoDuth commented 8 years ago

Of course!! Don't want to make things too easy :smile:

Will speak to them early next week. Just tried to open your file with everything I have here that will take .ps and all I get is a blank page with this at the top?: screenshot from 2016-01-16 14 03 41 Am I doing something wrong?

mfrasca commented 8 years ago

did you expect me to produce already a real label ? :open_mouth: before tomorrow, it might be, but at the moment I do not even know how to tell libreoffice to produce a custom sized page. and you should also ask your engraver if the 120×70 is the black frame or the red one, or if they need some extra millimetres margin outside the 120×70.

mfrasca commented 8 years ago

still not sure about page size, nor of the printed effect, nor whether the position of the parts are to your liking, but this does sort of print labels for the species in your selection. rough.zip

mfrasca commented 8 years ago

Mako is really powerful. very nice choice @brettatoms .

RoDuth commented 8 years ago

Wow looks great! Just had a go with the template. A few minor issues (e.g. doesn't do the infraspecific parts) but before anything, let me contact the engravers next week and make sure that it IS the sort of file they are looking for first.

Out of curiosity, in your opinion, Mako is better than the xsl formatter? I have not used the Mako formatter. Guess I should learn :fearful:

mfrasca commented 8 years ago

I'm on the opposite position: I never used the XSL formatter. I guess it's the correct tool for producing xml, while Mako looks to me fine for things like csv, (sloppy) html, and PostScript. without Mako already in place, I would have chosen Jinja2, just because I had used it elsewhere and it is probably more main-stream.

brettatoms commented 8 years ago

@mfrasca That's a good idea to use mako to generate the postscript. When I chose Mako ~10 years ago Jinja2 hadn't yet become the "winner" of the python templating languages. Today I use Jinja2 everywhere. Mostly because its bundled with Flask.

@RoDuth The reason for XSL is because it has a component called XSL-FO which is kind of like CSS but for paged and printed media. It's great for generating pixel perfect PDFs but it's extremely complicated and has a high learning curve. I probably would have reached for XSL first for this task as well but @mfrasca made a good call doing it this way with mako. Any day I can avoid using XSL is a good day. ;)

mfrasca commented 8 years ago

@brettatoms I'm still recovering from the emacs-lisp steep learning curve, I don't know if I want to learn xsl-fo. :boom: ... I've seen this pdf-xsl-fo relation in the docs, but I never investigated. :scream: @RoDuth when you see your engraver please make sure that if the label as it is now is not of the exact size... what size is it really! !! I guess it's 120mm×70mm, but I really would not be surprised if it's totally something else.

mfrasca commented 8 years ago

:bell:

mfrasca commented 8 years ago

@RoDuth writes:

[...] The local engravers have turned out to be a bit of a pain to deal with so I’ve started looking further afield. I found this page here: https://onlinelasercutting.com.au/file-setup/. Fairly sure their 2-tone plastic looks like what we are wanting to use. What do you think? Could you work with their system? They have a few different formats that they can use and should be able to put quite a few on a sheet.

mfrasca commented 8 years ago

@RoDuth , from their page I see they expect instructions for either:

I guess that you only want blue (line art) lines. I do not see how to make bold letters other than etching them twice. I am afraid that all the above work is not useful for this new system, and I would again write a mako template and have it produce an svg file. but I need to think and experiment.

mfrasca commented 8 years ago

I just sent them the following information request:

I am the current maintainer of a collection management software and have a request from an Australian botanical garden needing engraved labels. their request is to produce labels of which the attached postscript file is my current best approximation. would this be already an acceptable format for you? according to your color coding, I am only using your raster etch option, and I have an idea how to do line-art letters in postscript but it's a lot of programming. I can write a different template and have the software produce svg files, but from your instructions I do not understand if you would accept text elements (easy on my side) or if you only need path elements (again requiring me to program the letters). https://github.com/Bauble/bauble.classic/issues/227

mfrasca commented 8 years ago

http://www.evilmadscientist.com/2011/hershey-text-an-inkscape-extension-for-engraving-fonts/

mfrasca commented 8 years ago

download the (zip-file) version corresponding to your installed inkscape, unzip the archive, copy only the files matching hershey* to /usr/share/inkscape/extensions/ or possibly .config/inkscape/extensions/. the fonts do not contain glyphs for national characters.

mfrasca commented 8 years ago

their answer was "we do not do postscript" and we prefer svg, but it's not clear if they accept text elements in the svg files. so I asked them again and in the meanwhile I'm studying the options for producing paths, instead of outlined letters. and the two above comments are already in that direction. (stroke-based “engraving” fonts, opposed to "outline" fonts.) something I did not ask is whether their accept path elements with only straight line or if their plotters honour the curvatures in the paths and I assume they only do straight lines.

mfrasca commented 8 years ago

@HubelSB si no pudo seguir el desarrollo de la cosa: ahora tengo desde el programa la posibilidad de producir un archivo SVG, que describe la etiqueta de la planta, y lo hace con solo uso de path y use. nada de text, o sea todo es explicito en el archivo. al momento tengo 4 curvas (spline) que voy a quitar y poner segmentos derechos, para simplificar el trabajo de la grabadora. de un punto de vista software le veo una sola complicacion:

para mayor simplicidad, puedo evitar el uso de coordenadas absolutas y asegurarme que solo haya relativas. las lineas rojas son para cortar. las lineas azules son para quemar sin cortar. el grosor de las lineas no implica nada.

que le parece? si se atreven a producir el quemador, podrían hasta pensar de ofrecer el servicio de quema y envío internacional! :wink:

mfrasca commented 8 years ago

This issue was moved to Ghini/ghini.desktop#140