The density is directly given by \begin{equation*} \begin{split} \rho(z)&=\frac{\int dpAe^{-\beta(p^2/2m+mgz)}}{\int dp\int_0^hdzAe^{-\beta(p^2/2m+mgz)}}\\ &=\frac{e^{-\beta mgz}}{\int_0^hdze^{-\beta mgz}}=\frac{\beta mg}{1-e^{-\beta mgh}}e^{-\beta mgz} \end{split} \end{equation*} since the momentum is homogeneous throughout the system. Suppose there are N particles in total, then starting from a height $z$ till the top $h$, the total gravitational force would be given by $$F(z)=\int_z^h dz' A\rho(z')Nmg$$ after which you can obtain the pressure to be $F(z)/A$.