We report a first principles investigation of photocurrent generation by\ngraphene PN junctions. The junctions are formed by either chemically doping\nwith nitrogen and boron atoms, or by controlling gate voltages. Non-equilibrium\nGreen's function (NEGF) formalism combined with density functional theory (DFT)\nis applied to calculate the photo-response function. The graphene PN junctions\nshow a broad band photo-response including the terahertz range. The dependence\nof the response on the angle between the light polarization vector and the PN\ninterface is determined. Its variation against photon energy $E_{ph}$ is\ncalculated in the visible range. The essential properties of chemically doped\nand gate-controlled PN junctions are similar, but the former shows fingerprints\nof dopant distribution.\n