Don't Nail Too Close to Ends or Edges
Even with an 18-gauge trim nailer, you can split the molding if you're not careful. Avoid nailing less than 3/4 in. from the end of a trim piece or less than 1/4 in. from the edge.
Pin the Miter Before Nailing the Outside
In a perfect world, you could nail the trim flat to the wall and the miter would look great. But in reality, minor variations in level between the jamb and the wall often interfere. To solve this problem, start by pinning the inside edge of the trim, making sure the miter joint is pressed tight together. Then, while the miter is still tight, drive a pair of brads through the outside corners at opposite angles to pin it.
Shim Behind the Miter
If there's a slight gap between the molding and the wall, don't press the trim tight to the wall and nail it; the miter joint might open up. Instead, slip a thin shim between the molding and the wall. Then nail the outside edge of the trim. If the gap and shim are visible, fill the crack with caulk before painting.