TextOut using BeginDoc, EndDoc

I need to print text that has previously been formatted as Bold and/or
Italic using TextOut with  BeginDoc and EndDoc. The original text can come
from either a RichTextListBox or external file where the formatting takes
place. If I read from an external file or from a RichTextListBox, all
formatting is lost. I need to obtain text that has selected words Bold
and/or Inalic. How can this be done?