Surface plasmon polaritons and free-space beams are often coupled through periodic gratings. Here we show that by employing holographic-based techniques for modulating the grating, one can systematically control the amplitude and phase of the free-space beam. Alternatively, arbitrarily shaped surface plasmon can be generated. By using gratings with different periods for the input and output coupling, we obtain a planar beam transformer, whose resonance angles are related through a generalized form of the Bragg law. Specifically, we demonstrate the coupling of surface plasmon polaritons into focused free-space beams, as well as into accelerating Airy beams and vortex beams.