I had the same problem a couple of years ago... discovered through trial-and-error that I had a character format (to exclude text from spell check) applied to a veerrry long code text passage within a paragraph on the page on which the application always bailed out... I removed the character format from that text (and other long code text passages on the same page) and the PDF process proceeded as it should.
Good luck hunting for your fix... Cheryl Dwyer