It does depend on the software you're using, but it shouldn't be that difficult.
In Adobe Photoshop, for example, you can easily crop a resonably high-resolution photo to give you a headshot, whch you then paste as a new image. Click on "Print" and adjust the final print dimensions by entering the 45mm and 35mm sizes required in the new window that appears. The final print will be at the dimensions you require.
The print dpi is something you'd have to adjust in the printer settings windows prior to printing, but it does need to be high as Ethel indicated. Obviously, you need to ensure you're using photo-quality paper as well for the final print.
If you haven't got Photoshop, don't worry. Other software such as Photoshop Elements, Paintshop Pro and the Serif packages work along the same lines and there's suitable free software from Serif and other companies that will do the job. If you're not sure of the method, there's lots of tutorials on the web - Google "passport photo tutorial" possibly along with the software you're using.