Using a drill press to compress the assembly is very helpful and takes the stress out of it.
You place the frame in a vise on the drill press table with the spring, plunger and hammer in position. Then compress the hammer with the leverage of the drill press handle. You need something to push on and guide the hammer down as you pull the handle down and compress the spring.
Sometimes nothing more than a screwdriver type shape tool in the sear notch of the hammer works along with some guidance from your hand.
Others need a backing like VJP describes above.

Once it's compressed far enough, slide a slightly smaller diameter punch or rod through the frame & hammer to hold it there.
A tapered end to the punch helps catch the part and slides on thru.
Then tap the pin itself through pushing that punch back out.

Lacking a drill press,,it can be done with a large C-clamp. Just pad the ends sufficiently to avoid any damage to the contact points with the frame. It's a slower process but eccentially the same thing.
Use a real C-clamp. Not one of the pistol grip squeeze type clamps. I just don't trust them for compressing springs. Too much play in the clamp assembly for me.

With either of these,,wear good eye protection and double check your set up before compressing any springs and parts.
They can do real damage if they let go.