If you're using ROS you can simply use octomap_server
(
http://wiki.ros.org/octomap_server) which does all of this configurable
for you.
If you're not using ROS you have to do the downprojection yourself, but
you can still use the code of octomap_server as an example. As a rough
outline: iterate over all octree leafs, get their size (how many pixels
they cover) and mark the 2D map cells accordingly (e.g. occupied as soon
as there is one occupied voxel in the z-range you want to cover).
Best regards,
Armin