Compartir a través de


IXpsOMPackage::WriteToStream method

Writes the XPS package to a specified stream.

Syntax

HRESULT WriteToStream(
  [in] ISequentialStream *stream,
  [in] BOOL              optimizeMarkupSize
);

Parameters

  • stream [in]
    The stream that receives the serialized contents of the package. This parameter must not be NULL.

  • optimizeMarkupSize [in]
    A Boolean value that indicates whether the document markup is to be optimized for size when it is written to the stream.

    Value Meaning
    TRUE

    The package writer will attempt to optimize the markup for minimum size.

    FALSE

    The package writer will not attempt any optimization.

     

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
S_OK

The method succeeded.

E_POINTER

stream is NULL.

 

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

Remarks

The optimizeMarkupSize value determines whether the markup inside the individual document parts is to be optimized. It has no effect on how the parts are interleaved.

Note  Writing an XPS OM to a stream does not automatically create a thumbnail for the XPS document. To create a thumbnail of the XPS document, use the IXpsOMThumbnailGenerator interface.

 

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

Xpsobjectmodel.h

IDL

XpsObjectModel.idl

See also

IXpsOMPackage

ISequentialStream

Packaging Errors

XPS Document Errors

XML Paper Specification