We present a framework for the direct discretization of the input/output map of dynamical systems governed by linear partial differential equations with distributed inputs and outputs. The approximation consists of two steps. First, the input and output signals are discretized in space and time, resulting in finite dimensional spaces for the input and output signals. These are then used to approximate the dynamics of the system. The approximation errors in both steps are balanced and a matrix representation of an approximate input/output map is constructed which can be further reduced using singular value decompositions. We present the discretization framework, corresponding error estimates, and the SVD-based system reduction method. The theoretical results are illustrated with some applications in the optimal control of partial differential equations.