IXpsOMPackageWriter::Close method (xpsobjectmodel.h)

Closes any open parts of the package, then closes the package.


HRESULT Close();

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return code Description
The method succeeded.
A severe error occurred and the contents of the XPS OM might be unrecoverable. Some components of the XPS OM might still be usable but only after they have been verified. Because the state of the XPS OM cannot be predicted after this error is returned, all components of the XPS OM should be released and discarded.

This method calls the Packaging API. For information about the Packaging API return values, see Packaging Errors.


If any discardable parts that are referenced by a call to AddPage have not been received, an error will be returned.

After this method is called, calling any other IXpsOMPackageWriter method except IsClosed will return an error.


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header xpsobjectmodel.h

See also



Packaging Errors

Using the IXpsOMPackageWriter Interface

XML Paper Specification

XPS Document Errors