  In a previous paper, we showed how certain orientations of the edges of a
graph G embedded in a closed oriented surface S can be understood as discrete
spin structures on S. We then used this correspondence to give a geometric
proof of the Pfaffian formula for the partition function of the dimer model on
G. In the present article, we generalize these results to the case of compact
oriented surfaces with boundary. We also show how the operations of cutting and
gluing act on discrete spin structures and how they change the partition
function. These operations allow to reformulate the dimer model as a quantum
field theory on surface graphs.
