A novel way to realize a pi Josephson junction is proposed, based on a weak link in an unconventional d-wave superconductor with appropriately chosen boundary geometry. The critical current of such a junction is calculated from a fully selfconsistent solution of microscopic Eilenberger theory of superconductivity. The results clearly show, that a transition to a pi Josephson junction occurs for both low temperatures and small sizes of the geometry.