A large area pulsed electron beam is produced by a high-voltage barrier discharge. We compare the properties of the x-rays generated by stopping this beam of electrons in a thin metal foil with those generated by stopping the electrons directly in various gases. The generation of x-rays was investigated in He, Ne and Ar with and without an Al foil in the discharge chamber. It appears that, for voltages of up to 15 kV used in our experiments, x-rays are produced by the 'bremsstrahlung' mechanism and that characteristic x-ray radiation does not play an important role. The x-ray intensity strongly depends on the parameters of the electron beam (electron energy and current density) and the stopping material properties (Z-number). The energy of the x-ray photons is comparable to the applied voltage. The highest obtained energy in the x-ray spectrum depends on the electron energy (~10 keV in the investigated case) and the lowest energy is determined by the transmittance of the output window and the window of the detector.