  We derive an analytic expression for the mechanical pressure of a generic
one-dimensional model of confined active Brownian particles (ABPs) that is
valid for all values of Peclet number Pe and all confining scenarios. Our model
reproduces the known scaling of bulk pressure with Pe^2 while in strong
confinement pressure scales with Pe. Our analytic results are very well
reproduced by simulations of ABPs in 2D. We use the pressure formula to
calculate both the work performed by an active engine and its efficiency. In
particular, efficiency is maximized for work cycles with finite period and not
in the limit of infinitely slow cycles as in thermodynamic engines.
