IXpsOMPage::Write method (xpsobjectmodel.h)

Writes the page to the specified stream.


  [in] ISequentialStream *stream,
  [in] BOOL              optimizeMarkupSize


[in] stream

The stream that receives the serialized contents of the page.

[in] optimizeMarkupSize

A Boolean value that indicates whether the document markup of the page is to be optimized for size when the page is written to the stream.

Value Meaning
The package writer will attempt to optimize the markup for minimum size when writing the page to the stream.
The package writer will not attempt any optimization when writing the page to the stream.

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.
stream is NULL.


To examine the XPS markup of a page before it is written to an XPS package, an application can call the Write method to write the page's contents to a stream. The application can then read that stream to examine the XPS markup as it would be serialized when it is written to the XPS package.

The XPS markup that is written to the stream by this method contains the page markup but none of the page's resources.


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



XML Paper Specification

XPS Document Errors