1. A method comprising: acquiring an electronic image of a document with a fixed structure, wherein the fixed structure comprises field names and field values corresponding to the field names, and wherein the field names and the field values are located at set locations in the document; recognizing key words in the electronic image of the document, wherein the key words comprise the field names and the field values; matching one or more templates from a plurality of templates with the document, wherein the one or more templates comprise reference objects that specify areas in the electronic image of the document where permitted field values corresponding to field names are to be extracted, and wherein matching the one or more templates comprises matching the field names and the permitted field values from the one or more templates with the identified field names and the field values from the recognized key words; selecting, by a processor device, a template from the one or more templates based on a quality of a match between the field names and the permitted field values from the template with the identified field names and the field values from the recognized key words; and extracting the field values from the electronic image of the document using the selected template.