Posted on: 3/18/2011 2:07:45 AM | Views : 354

A requirement of a program I am making is that it can 'print' a given URL into a PDF - the server has a PDF printer installed (and is the default printer), so it's just a matter of printing the page programmaticly, and it seems the best way is to use the WebBrowser control - however, I am running into issues
 
protected void Page_Load(object sender, EventArgs e) { Thread thread = new Thread(new ThreadStart(Print)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); } public void Print() { WebBrowser wb = new WebBrowser(); wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted); wb.Url = new Uri("http://www.google.co.uk"); wb.Navigate("http://www.google.co.uk"); ...

Go to the complete details ...