1. A method comprising: receiving, by a processor, a first template document, wherein the first template document comprises a first plurality of text objects; and receiving by the processor, a reference document, wherein the reference document comprises second a plurality of text objects, wherein at least one of the first template document and the reference document are misaligned or upside down during the following steps: identifying by the processor, the first plurality of text objects in the first template document; identifying by the processor, the second plurality of text objects in the reference document; identifying by the processor, a plurality of common identical text objects between the first template document and the reference document; identifying by the processor, locations of the plurality of common identical text objects in the first template document; identifying by the processor, two or more distances between the locations of the plurality of common identical text objects in the first template document; identifying by the processor, locations of the plurality of common identical text objects in the reference document; identifying by the processor, two or more distances between the locations of the plurality of common identical text objects in the reference document; determining, by the processor, that the two or more distances between the plurality of common identical text objects in the first template document are within a given percentage of variance as the two or more distances between the plurality of common identical text objects in the reference document; and in response to determining that the two or more distances between the plurality of common identical text objects in the first template document are within the given percentage of variance as the two or more distances between the plurality of common identical text objects in the reference document, grouping the first template document and the reference document as common documents, wherein an endpoint of a first one of the two or more distances between the plurality of common identical text objects in the first template document is used as a starting point for a second one of the two or more distances between the plurality of common identical text objects in the first template document and wherein an endpoint of a first one of the two or more distances between the plurality of common identical text objects in the reference document is used as a starting point for a second one of the two or more distances between the plurality of common identical text objects in the reference document.