Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top