IXpsOMPackage::WriteToFile method (xpsobjectmodel.h)
Writes the XPS package to a specified file.
Syntax
HRESULT WriteToFile(
[in] LPCWSTR fileName,
[in] LPSECURITY_ATTRIBUTES securityAttributes,
[in] DWORD flagsAndAttributes,
[in] BOOL optimizeMarkupSize
);
Parameters
[in] fileName
The name of the file to be created. This parameter must not be NULL.
[in] securityAttributes
The SECURITY_ATTRIBUTES structure, which contains two distinct but related data members:
- lpSecurityDescriptor: an optional security descriptor
- bInheritHandle: a Boolean value that determines whether the returned handle can be inherited by child processes
For more information about the securityAttributes parameter, refer to CreateFile.
[in] flagsAndAttributes
Specifies the settings and attributes of the file to be created. For most files, a value of FILE_ATTRIBUTE_NORMAL can be used.
For more information about the flagsAndAttributes parameter, refer to CreateFile.
[in] optimizeMarkupSize
A Boolean value that indicates whether the document markup is to be optimized for size when it is written to the file.
Value | Meaning |
---|---|
|
The package writer will attempt to optimize the markup for minimum size. |
|
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 |
---|---|
|
The method succeeded. |
|
fileName 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.
Requirements
Requirement | Value |
---|---|
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 |