GnomeCanvasItem *item = NULL;
GList *list = NULL;
gint i, ix, iy;
- gdouble x1, y1, x2, y2;
+ gdouble x1, y1, x2, y2, y_temp;
+ const GnomePaper *paper = NULL;
+ gdouble paper_height;
+
+ /* get paper height */
+ paper = gnome_paper_with_name (template->page_size);
+ paper_height = gnome_paper_psheight (paper);
group = gnome_canvas_root (canvas);
/* draw mini label outlines */
i = 1;
- for (iy = 0; iy < template->ny; iy++) {
+ for (iy = (template->ny - 1); iy >= 0; iy--) {
for (ix = 0; ix < template->nx; ix++, i++) {
x1 = ix * (template->dx) + template->x0;
x2 = x1 + template->label_width;
y2 = y1 + template->label_height;
+ /* transform origin from lower left to upper left */
+ /* and swap y's so that (y1 < y2) */
+ y_temp = y2;
+ y2 = paper_height - y1;
+ y1 = paper_height - y_temp;
+
switch (template->style) {
case GL_TEMPLATE_STYLE_RECT:
item = gnome_canvas_item_new (group,