Depending on how large your text file is, you may want to download it in chunks and print each chunk as you get it. If the printer takes a long time to print each chunk you may have to buffer the file into an SD card first, then read and print each chunk from the SD card.
I have an example here of grabbing data from the web. You could point this to any file and get the same results.
One thing you are going to have to do is detect where the end of the response header is, and your file begins. That’s not in my example.
Also here’s the SD card stuff:
Let us know how it goes!