Question

I converted an XpsDocument to FixedDocumentSequence (in a converter) using myXpsDocument.GetFixedDocumentSequence(); method .

Now I need the XpsDocument.Uri in code behind to release its file lock :

System.IO.Packaging.PackageStore.GetPackage(xpsUri).Close();
System.IO.Packaging.PackageStore.RemovePackage(xpsUri);

And problem is : How can I access the XpsDocument (or its Uri) in Code behind.

Was it helpful?

Solution

Instead of disposing it from code behind, you should dispose it as soon as you get it converted to FixedDocumentSequence may be inside converter only since no need to hold onto it once it gets converted to fixed document sequence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top