The easiest way to acheive this is by using the
WebRequest
class. You would download all of the content and place it into some sort of container (I typically use the
StringBuilder
class but could be another stream). Then you would write the content of the container to your PDF document. You will most like need to strip out the extra HTML tags and play with the formatting.
HashSet<string> urls = new HashSet<string>() { "http://www.microsoft.com", "http://www.google.com", "http://www.codeproject.com" };
StringBuilder contentToWrite = new StringBuilder();
foreach (var url in urls)
{
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();
using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
{
contentToWrite.Append(streamReader.ReadToEnd());
}
}
</string></string>