By "print to text file" do you mean to save the text into the file? Try look here.