This paper deals with the numerical simulation of electrocardiograms (ECG). Our aim is to devise a mathematical model, based on partial differential equations, which is able to provide realistic 12-lead ECGs. The main ingredients of this model are classical: the bidomain equations coupled to a phenomenological ionic model in the heart, and a generalized Laplace equation in the torso. The obtention of realistic ECGs relies on other important features--including heart-torso transmission conditions, anisotropy, cell heterogeneity and His bundle modeling--that are discussed in detail. The numerical implementation is based on state-of-the-art numerical methods: domain decomposition techniques and second order semi-implicit time marching schemes, offering a good compromise between accuracy, stability and efficiency. The numerical ECGs obtained with this approach show correct amplitudes, shapes and polarities, in all the 12 standard leads. The relevance of every modeling choice is carefully discussed and the numerical ECG sensitivity to the model parameters investigated.