Shape metadata


Web-to-print templates contain information about shape and field position, alignment, anchor points and other metadata to assist with client side scripting and interactive editing in dynamic imaging and web-to-print applications. This post describes some of the metadata parameters and concepts.


The system of coordinates is based on the visible part of a page design (preview). The top-left corner x:0, y:0, bottom-right corner x:1,y:1.

The actual page can be different from the visible part. It can be bigger (no page boundary, all objects inside the page) or smaller (some objects are outside the page border). For example, if a user enters very long text it may push out the boundaries of the visible part outside the page.

The coordinates are expressed in relation to the preview image.

Shape coordinates

A template can contain any number of shapes under this XML path TemplateDetails/Pages/Page/Shape.

All coordinates and lengths are expressed in relation to the length of the side on this axis. E.g. width = 100px, x=0.2, so the actual position of x in the image = 100px * 0.2 = 20px from the left.

A shape may have a set of attributes:

  • fields – a comma separated list of field names contained in the shape
  • box-x1, box-y1 – top left corner
  • box-x2, box-y2 – bottom corner
  • anchor-x, anchor-y – position of the anchor point for the shape
  • align-h, align-v – horizontal (l, c, r) and vertical (t, c, m) alignment

The attributes above describe the default preview image.  When a user preview is generated the XML contains an additional set of attributes with -u suffix. E.g. box-x1-u, box-y1-u.

Page coordinates

In some cases it may be important to know where the actual page boundaries are. It can be used as the true point of reference for all user previews.

The coordinates are expressed in relation to the top left corner of visible part (preview) and unlike shape coordinates can be negative and more than 1. The units of measure are relative to the width (x) and height (y) of the preview image.

  • page2box-x, page2box-y – coordinates of the top-left corner of the page in relation to the top-left corner of the visible area (preview)
  • page2box-w, page2box-h – width and height of the page in relation to the width and height of the visible area (preview)


Assume that the preview image width Pw= 100px, height Ph= 200px, the center of the coordinate system is at the top left corner of the preview, X-axis goes right, Y-axis goes down.

Relative values:

  • page2box-x = -0.2
  • page2box-y=0.25
  • page2box-w=1.5
  • page2box-h=0.75

Absolute position calculations:

  • page2box-x = -0.2 * Pw = -0.2 * 100px = -20px
  • page2box-x = 0.25 * Ph = 0.25 * 200px = 50px
  • page2box-w = 1.5 * Pw = 1.5 * 100px = 150px
  • page2box-h = 0.75 * Ph = 0.75 * 200px = 150px

Incorrect and missing data

Web-to-print templates with no page2box attributes have no or an old version of the coordinates. Such templates need to be re-processed without re-uploading to update the coordinates.

See also: