tuespetre / TuesPechkin

A .NET wrapper for the wkhtmltopdf library with an object-oriented API.
326 stars 116 forks source link

Qt: Could not initialize OLE (error 80010106) #182

Open Lej opened 5 years ago

Lej commented 5 years ago

I made a minimal .NET Framework 4.6.1 console app with TurePechkin v2.1.1 and TuesPechkin.Wkhtmltox.AnyCPU 0.12.4.1:

        static void Main(string[] args)
        {
            var converter =
                new StandardConverter(
                    new PdfToolset(
                        new WinAnyCPUEmbeddedDeployment(
                            new TempFolderDeployment())));

            converter.Convert(new HtmlToPdfDocument
            {
                Objects =
                {
                    new ObjectSettings
                    {
                        HtmlText = "<h1>Hello World!</h1>",
                    }
                }
            });

            Console.ReadKey();
        }

When I run it I the following gets printed:

image

How do I prevent this error?

ylwlf888 commented 4 years ago

i'm too

nataz77 commented 3 years ago

For those who might find this issue in the future, I've hit the same problem and resolved using a single threaded apartment

[STAThread]
static void Main(string[] args)
{
   ...code here...
}