The ultraviolet photoabsorption spectra of the HCN and HNC isomers have been simulated in the 7-10 eV photon energy range. For this purpose, the three-dimensional adiabatic potential energy surfaces of the 7 lowest electronic states, and the corresponding transition dipole moments, have been calculated, at multireference configuration interaction level. The spectra are calculated with a quantum wave packet method on these adiabatic potential energy surfaces. The spectra for the 3 lower excited states, the dissociative electronic states, correspond essentially to predissociation peaks, most of them through tunneling on the same adiabatic state. The 3 higher electronic states are bound, hereafter electronic bound states, and their spectra consist of delta lines, in the adiabatic approximation. The radiative lifetime towards the ground electronic states of these bound states has been calculated, being longer than 10 ns in all cases, much longer that the characteristic predissociation lifetimes. The spectra of HCN is compared with the available experimental and previous theoretical simulations, while in the case of HNC there are no previous studies to our knowledge. The spectrum for HNC is considerably more intense than that of HCN in the 7-10 eV photon energy range, which points to a higher photodissociation rate for HNC, compared to HCN, in astrophysical environments illuminated by ultraviolet radiation.