Subject: ActiveX control '........' cannot be instantiated because
Date: 2012-01-11 10:10:15
From: Nick Franklin
Source: activex-control-cannot-instantiated
----------------------------------------------------------------------

I am trying to create a PDF document from an HTML page
The HTML page does not exist, but is created on the fly by building a string containing the content, then displaying that content using response.write(html).

The html can be very long and includes images.

I have the following code:-

Dim document As New PdfDocument()

        Dim page As PdfPage = document.Pages.Add()

        Dim htmltext As String = html

        Dim options As New Html2PdfOptions()

        options.EnableJavaScript = True

        options.AutoDetectPageBreak = True

        options.EnableHyperlinks = False

        options.SplitTextLines = True

        document.ImportHtml(htmltext, options)

        document.Save("c:\mytemp\Test.pdf")

        document.Close()


The html displays on the screen correctlyand I show a button to create a pdf from the same html.
I get the following error:-
ActiveX control '....' cannot be instantiated because the current thread is not in a single-threaded apartment.

Thanks 

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index