Active
Project:
Mailing Label EZH
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2011 at 22:33 UTC
Updated:
29 Nov 2011 at 09:34 UTC
Jump to comment: Most recent file
Per recommendation of martinst, I would like to support the label format templates provided by glabels. For example:
http://git.gnome.org/browse/glabels/tree/templates/avery-us-templates.xm...
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | xml_parsing.diff | 10.44 KB | martinst |
Comments
Comment #1
martinst commentedI have written the parsing code and most of the file handing code which, once I got my head around it, was relatively easy. There are a number of issues still to solve ... the label definitions come in a mixture of units so the use of the values is not straight forward. On the 7160 label dy is "108.0" which should be 38.1mm. On the 6121 label dy is "60.12pt". On the L4770 label dy is "25.4mm". Looks like a small parsing function is required to standardise the values.
Another issue is when to read and parse the xml files. I think we only want to do this once when the view is created and the label type selected. At this point all the label values need to be stored for future use. I think the way the code is currently structured the files would be parsed every time a pdf was created.
I will create a diff of my work soon so you can have a look.
Comment #2
ezheidtmann commentedHey Martin, thanks for working on that. Please do share your code.
I wrote some parsing code yesterday. I think I've got the unit problem taken care of. http://drupalcode.org/sandbox/clydefrog/1328782.git/shortlog/refs/heads/...
Please send me your code anyway and we can pick the best elements of both implementations.
Comment #3
martinst commentedThe XML parsing code is complete together with the unit conversion. I convert all the units to mm to make things standard. The module works to the point of offering all the types of labels with correct names and numbers but at that point I am a bit lost in the drupal code. I have written routines to save and retrieve the template values but I don't know where to call the saving routine from with the selected format. I have currently commented out the call to the data retrieve routine which will populate the array element ready for pdf preparation.
I have attached a diff of the work so far. It took many iterations to get the xml code to work but once working it really looks quite simple. I am sure there are more elegant ways to do some of the php so see what you think.
Comment #4
martinst commentedOne item that has been lost by using these xml files is the font to be used on the label. I thing we need to add another dropdown selection item on the view creation page.