Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed May 21, 2014 11:26 am

Hi, i am testing the free version of SPIRE.PDF but i have an error trying to load a url into the component.

Windows 7, 64bits, Visual Studio 2010, webforms net framework 4.0

Relevant code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing;
using Spire.Pdf;

PdfDocument doc = new PdfDocument();
doc.LoadFromHTML(myurl, false, false, false);


Error:
ThreadStateException

No se puede crear una instancia del control ActiveX '8856f961-340a-11d0-a96b-00c04fd705a2' porque el subproceso actual
no está en un contenedor uniproceso.

Could you help me to test your component in webforms net 4.0 with visual studio 2010?

Thanks

dscsoft
 
Posts: 2
Joined: Wed May 21, 2014 7:41 am

Thu May 22, 2014 2:15 am

Hello,
Thanks for your feedback.
Please add AspCompat="true" to the aspx page code:<%@ Page...%> , for example,

<%@ Page Language="C#" AspCompat="true" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="...WebForm1" %>.
Or you can also use the single thread.
Code: Select all
Thread thread = new Thread(() =>
 {
doc.LoadFromHTML("file:///C:/contrato/s.html", true, true, false, setting);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();


Please don't hesitate to contact us for further problems.

Best regards,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue May 27, 2014 9:27 am

Hello,

Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue May 27, 2014 9:49 am

Thanks Gary. The issue is resolved with your indications.

Regards, Diego.

dscsoft
 
Posts: 2
Joined: Wed May 21, 2014 7:41 am

Wed May 28, 2014 1:38 am

Glad to hear that.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDF