I'm trying to create a "hello world" ASP.NET program to convert an existing html page to a pdf. Based on the sample code I've been able to find, I have this so far:
Dim doc As PdfDocument = New PdfDocument()
Dim page As PdfPage = doc.Pages.Add()
Dim html As New HtmlConverter
Dim img As System.Drawing.Image = html.ConvertToImage("
http://www.mysite.com", ImageType.Bitmap)
Dim Image As PdfImage = New PdfBitmap(img)
Dim fmt As New PdfLayoutFormat
fmt.Break = PdfLayoutBreakType.FitPage
fmt.Layout = PdfLayoutType.Paginate
Image.Draw(page, New RectangleF(0, 0, 700, 1000), fmt)
But, the HtmlConverter class seems to require a reference to Windows.Forms and I get the error:
"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."
Can the HtmlConverter class be used with ASP.NET??
bert