>The above code creates a pdf file but it can't be opened by Adobe Acrobat. Any idea why?
Which version of Acrobat? I've found out that Adobe is slightly changing the specs for the PDF format, so some things which could be opened with previous versions (and created by third party generators) can't be opened, or some parts won't display in Acrobat 9.
Try to open with Foxit:
http://www.foxitsoftware.com/ - I've found it's much faster and not so bloated like the recent versions of Acrobat. I've so far found only three documents over the last five years which wouldn't print right (two of them were scanned hand drawings which printed blank, and the third is my car insurance card which prints, but in Greek :).