After removing the old five-sided door, measure the doorway opening. When you have their measurements, lay the door on sawhorses.
Mark the pre-hung door for the opening adding an inch or two for carpet to run underneath the door. Put painter’s tape along the length of their mark (Image 1) and on the plate of the saw (Image 2). Then cut the door along the mark (Image 3). Applying painter’s tape over the mark keeps the door from being marred by the saw and to keep the door from splitting while cutting.
Next, measure and cut the door frame. These measurements do not have to account for the carpeting.
Hold the door while someone screws the hinges and the door together. Then walk the door over to the doorway.
When the door is level, shoot framing nails through the frame to the wall, making sure to preserve the spaces between the door and the wall.
Finally, apply low expansion foam to the spaces between the door and the wall, filling the spaces around the nails first. The foam expands, hardens and keeps the door in place and can be used instead of shims. Cut any excess foam flush to the wall after the foam dries with a straight edge.
Cover the gaps with trim.