heredoc is just plain text. So this is probably what you are looking for...
doc.write("htmlToText($this->HTMLContent)");
I don't know anything about the htmlToText function but the problem I see with it is if your html has " in it then it will it pair up with the starting ones?