We consider the sine-Gordon equation in laboratory coordinates with both x and t in [0, ∞). We assume that u(x, 0), ut(x, 0), u(0, t) are given, and that they satisfy u(x, 0)→2πq, ut(x, 0)→0, for large x, u(0, t)→2πp for large t, where q, p are integers. We also assume that ux(x, 0), ut(x, 0), ut(0, t), u(0, t)-2πp, u(x, 0)-2πq e L2. We show that the solution of this initial-boundary value problem can be reduced to solving a linear integral equation which is always solvable. The asymptotic analysis of this integral equation for large t shows how the boundary conditions can generate solitons.