Theory of the interaction between an electron beam and a thin solid film