I am trying to use this code in asp.net, but the process seems to be running forever.
Do you know if this can work in asp.net or winforms only ?
Thanks,
- Code: Select all
PdfDocument doc = new PdfDocument();
String url = "http://www.google.com/";
Thread thread = new Thread(() =>
{
doc.LoadFromHTML(url, false, true, true);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
doc.SaveToFile("result.pdf");
doc.Close();