Topology optimization offers great opportunities to design permanent magnetic systems that have specific external field characteristics. Additive manufacturing of polymer bonded magnets with an end-user 3D printer can be used to manufacture permanent magnets with structures that have been difficult or impossible to manufacture previously. This work combines these two powerful methods to design and manufacture permanent magnetic system with specific properties. The topology optimization framework is simple, fast, and accurate. It can be also used for reverse engineering of permanent magnets in order to find the topology from field measurements. Furthermore, a magnetic system that generate a linear external field above the magnet is presented. With a volume constraint the amount of magnetic material can be minimized without losing performance. Simulations and measurements of the printed system show a very good agreement.