I had something similar in a project after I upgraded the Rich Text widget. The HTML it was generating was adding additional attributes to tags, which worked when shown on a page, but was breaking document generation. My quick fix was to downgrade to an older version of the Rich Text widget. I meant to go back when I had time to see if there was a better solution, but it's still on my todo list.
I hope this helps.