Young, fast-rotating neutron stars are promising candidate sources for the production of ultrahigh energy cosmic rays (UHECRs). The interest in this model has recently been boosted by the latest chemical composition measurements of cosmic rays, that seem to show the presence of a heavy nuclear component at the highest energies. Neutrons stars, with their metal-rich surfaces, are potentially interesting sources of such nuclei, but some open issues remain: 1) is it possible to extract these nuclei from the stars surface? 2) Do the nuclei survive the severe conditions present in the magnetosphere of the neutron star? 3) What happens to the surviving nuclei once they enter the wind that is launched outside the light cylinder? In this paper we address these issues in a quantitative way, proving that for the most reasonable range of neutron star surface temperatures ($T<10^7,$K), a large fraction of heavy nuclei survive photo-disintegration losses. These processes, together with curvature losses and acceleration in the stars electric potential, lead to injection of nuclei with a chemical composition that is mixed, even if only iron is extracted from the surface. We show that under certain conditions the chemical composition injected into the wind region is compatible with that required in previous work based on purely phenomenological arguments (typically $sim 50%$ protons, $sim 30%$ CNO and $sim 20%$ Fe), and provides a reasonable explanation of the mass abundance inferred from ultra high energy data.