Error Exporting to XPS

mbbergen posted this 20 January 2017

We are currently evaluating the toolkit and ran across an error while trying to export to xps. The error is: "The calling thread must be STA, because many UI components require this". The types of elements we are using in our Word document are: Barcode, Field and Chart. We are also using Word's Text Box control.

Also, when exporting to pdf, the Chart control doesn't render. Is the Chart control not supported by the pdf rendering engine?

I have attached a sample project that we are using to evaluate.

Thanks, Matt

Last edited 20 January 2017

1 Posts
1 Points
Order By: Standard | Newest | Votes
admin posted this 21 January 2017

Hi Matt,

Thank you for reporting the issue. Docentric Toolkit engine still uses WPF to render XPS documents and WPF requires a STA thread to acceess WPF classes. Which is nothing wrong, but it an ASP.NET spawns MTA threads which cannot handle WPF objects.The solution is to manually spawn an STA thread manually and do XPS rendering with the new thread. Anyway, we are going to fix this in version 5.0 anyway so I suggest that you rather use the new version of Docentric Toolkit (v5.0) instead.

Yes, you are right, PDF/XPS rendering engine doesn't support charts yet. You will need to use an external tool to render charts as images and then display those images on a template document.

I hope this helps, Jure Leskovec

12 Posts
21 Points

Our 30759 members have posted 271 times in 80 discussions