This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Running pdfcrowd API on BackgroundWorker (C#) failing

venki5star wrote on 2014-04-03:
I am using this API in a WCF service. I want the conversion to happen on background as I need to convert more files. The conversion works fine without BackgroundWorker. It fails immediately, if its moved into the background. There is not error information provided by the API to post here.

The StackTrace of the Error is,

   at pdfcrowd.Client.do_request(String uri, Stream out_stream, Object data, String content_type)
   at pdfcrowd.Client.call_api(String uri, Stream out_stream, String src)
   at pdfcrowd.Client.numTokens()

Anyone know how to use this API on threading or backgroundworker?

support wrote on 2014-04-04:

I'm not familiar with WCF but in general, it should not make any difference whether you use the API on the main thread or in BackgroundWorker. Could you try to wrap your code that calls the API with a try-catch block as follows?
  // call the API
catch(pdfcrowd.Error why) {
  // log why.ToString()

What does why.ToString() return?