Compartir a través de


IXpsOMObjectFactory1::CreatePackageFromStream1 method

Opens a stream that contains an XPS package and returns an instantiated XPS document object tree.

This method will read a stream that contains an XPS document that is of type XPS_DOCUMENT_TYPE_ XPS or XPS_DOCUMENT_TYPE_ OPENXPS.

Syntax

HRESULT CreatePackageFromStream1(
   [in]            IStream *         stream,
   [in]            BOOL              reuseObjects,
   [out, retval]   IXpsOMPackage1 ** package 
);

Parameters

  • stream
    [in] The stream that contains an XPS package.

  • reuseObjects
    [in] The Boolean value that indicates that the software is to attempt to optimize the document object tree by sharing objects that are identical in all properties and children.

    TRUE: The software will attempt to optimize the object tree.

    FALSE: The software will not attempt to optimize the object tree.

  • package
    [out, retval] A pointer to the new IXpsOMPackage1 interface that contains the resulting XPS document object tree.

Return value

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

S_OK: The method succeeded.

XPS_E_UNEXPECTED_NAMESPACE: The package markup uses a namespace that is not supported by the document type.

XPS_E_ABSOLUTE_REFERENCE: The OpenXPS document contains XML elements that use absolute URIs to reference other parts in the document.

Remarks

Use this method to read a stream that contains an XPS document that could be of type XPS_DOCUMENT_TYPE_ XPS or XPS_DOCUMENT_TYPE_ OPENXPS. CreatePackageFromStream, released in Windows 7, only opens streams that contain an XPS document of type XPS_DOCUMENT_TYPE_ XPS.

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

XpsObjectModel_1.h

IDL

XpsObjectModel.idl

Library

None

See also

IXpsOMObjectFactory1