Your problem has nothing to do with code related to creating or using an XPS document. It has everything related to the thread in which you work.
You will receive an error The calling thread must be STA, because many UI components require thiswhenever any of the following actions are taken in the MTA stream:
- , FrameworkElement ( )
- , BitmapEffect
- , TextComposition
- , HwndSource
- InputManager
- KeyboardDevice, StylusDevice TabletDevice
- FrameworkContentElement
- , IME ,
- WPF .
- ,
- ,
, , XAML, <Button> WPF WCF. : STA .
, XPS . , GetFixedDocumentSequence TextComposition .
, STA , , , XpsDocuments, MTA. (, ) STA.
, , XPS-, GUI? ? WCF -? ASPX? , , , .
, , GetFixedDocumentSequence, . , . , , , , , STA .