views:

5

answers:

0

How do I save DocumentPaginator initialized with a FlowDocument? According to MSDN I should be able to use a SerializerProvider to get a SerializerWriter, but creating a SerializerProvider throws an UnauthorizedAccessException: "Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WinFX Serializers' is denied.".

Is there another way to get a SerializerProvider or a way to create a XpsDocumentWriter?

I don't want to save using a TextRange, since I use a custom DocumentPaginator that adds a header and a footer.

edit

It turns out that I can create an XpsDocumentWriter from the PrintQueue without providing an actual queue, but this opens the print dialog. Are there any better hacks than this?