Scattering of light on the surfaces of photonic crystals