High-order harmonic generation provides an opportunity for generating intense extreme ultraviolet attosecond pulses, which is useful to explore the property of materials. Transmitted radiation emitted by an ultrathin target illuminated by intense lasers is a promising way to generate such pulses. We show that the preplasma density gradient has an important influence on the transmitted radiation. An optimal scale length exists to support ultrathin nanobunches to generate coherent synchrotron emission and thus enormously enhance the radiation. Particle in cell simulations suggest that the optimal scale length depends on the laser intensity.