  Aims. We investigate the dominant formation mechanism of H2CO and CH3OH in
the Horsehead PDR and its associated dense core. Methods. We performed deep
integrations of several H2CO and CH3OH lines at two positions in the Horsehead,
namely the PDR and dense core, with the IRAM-30m telescope. In addition, we
observed one H2CO higher frequency line with the CSO telescope at both
positions. We determine the H2CO and CH3OH column densities and abundances from
the single-dish observations complemented with IRAM-PdBI high-angular
resolution maps (6") of both species. We compare the observed abundances with
PDR models including either pure gas-phase chemistry or both gas-phase and
grain surface chemistry. Results. We derive CH3OH abundances relative to total
number of hydrogen atoms of ~1.2e-10 and ~2.3e-10 in the PDR and dense core
positions, respectively. These abundances are similar to the inferred H2CO
abundance in both positions (~2e-10). We find an abundance ratio H2CO/CH3OH of
~2 in the PDR and ~1 in the dense core. Pure gas-phase models cannot reproduce
the observed abundances of either H2CO or CH3OH at the PDR position. Both
species are therefore formed on the surface of dust grains and are subsequently
photodesorbed into the gas-phase at this position. At the dense core, on the
other hand, photodesorption of ices is needed to explain the observed abundance
of CH3OH, while a pure gas-phase model can reproduce the observed H2CO
abundance. The high-resolution observations show that CH3OH is depleted onto
grains at the dense core. CH3OH is thus present in an envelope around this
position, while H2CO is present in both the envelope and the dense core itself.
Conclusions. Photodesorption is an efficient mechanism to release complex
molecules in low FUV-illuminated PDRs, where thermal desorption of ice mantles
is ineffective.
