Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top