1. A computer readable medium storing a computer program which when executed by at least one processor analyzes a document, the computer program comprising sets of instructions for: receiving a document that comprises a plurality of primitive graphic elements, each primitive graphic element defined as a single object in the document, the document having a drawing order that indicates the order in which the primitive graphic elements are drawn when the document is displayed; calculating, for a first primitive graphic element and a second primitive graphic element that is subsequent to the first in the drawing order, a size of a single element that comprises the first and second primitive graphic elements; and based on the size of the single element compared to a plurality of different size calculations for additional primitive graphic elements that are subsequent in the drawing order, defining a single structural graphic element within the document from the first and second primitive graphic elements.