How to generate and print large XPS documents in WPF?
Posted
by bitbonk
on Stack Overflow
See other posts from Stack Overflow
or by bitbonk
Published on 2010-02-26T15:23:09Z
Indexed on
2010/03/09
3:21 UTC
Read the original article
Hit count: 757
I would like to generate (and then print or save) big XPS documents (>400 pages) from my WPF application. We have some large amount of in-memory data that needs to be written to XPS.
How can this be done without getting an OutOfMemoryException
? Is there a way I can write the document in chunks? How is this usually done? Should I not be using XPS for large files in the first place?
The root cause of the OutOfMemoryException
seems to be the creation of the huge FlowDocument
. I am creating the full FlowDocument
and then sending it to the XPS document writer. Is this the wrong approach?
© Stack Overflow or respective owner