I wrote a python script to convert the output of pdf2xml (from Mobipocket Creator) to html which is suitable for converting to ebook formats. I wrote it specifically to handle code indentation properly. It uses the same source that Mobipocket Creator uses and tries to do an even better job. It is opensource (GPL) so you can tweak it if you know python. I posted about it at
http://talkings.org/2009/05/03/complex-pdf-html/. The download link is there as well.