1. A computer readable medium storing a computer program for execution by one or more processing units, the computer program for identifying a selection of primitive areas in a page of a document, the computer program comprising sets of instructions for: receiving a ordered list of primitive areas in the page; receiving a selection point specifying a location in the page; identifying a primitive area that is closest to the location specified by the selection point; and assigning a selection index based on a position of the closest primitive area in the ordered list of primitive areas.