This paper researches control problem for active power filters with three-level NPC inverter and proposes a novel PI control algorithm for tracking harmonic command current. This novel PI control algorithm can suppress the periodic error in the whole system to achieve zero steady error tracking. In this scheme, the state variables are estimated with a state observer to cancel the delay of one sampling period in this digital control system. Harmonic current is predicted with a repetitive algorithm simultaneity, which makes use of the repetitive nature of load current. The controller is analyzed and designed in the paper, and the experiment results illustrate that this APF can be controlled in a satisfactory way.