Share via


IXpsOMObjectFactory1::CreatePackageWriterOnFile1 method

Opens a file for writing the contents of an XPS OM to an XPS package of a specified type. This method produces a package writer for either an MSXPS document or an OpenXPS document.

Syntax

HRESULT CreatePackageWriterOnFile1(
   [in, string]    LPCWSTR                     fileName,
   [in, unique]    LPSECURITY_ATTRIBUTES       securityAttributes,
   [in]            DWORD                       flagsAndAttributes,
   [in]            BOOL                        optimizeMarkupSize,
   [in]            XPS_INTERLEAVING            interleaving,
   [in]            IOpcPartUri *               documentSequencePartName,
   [in]            IXpsOMCoreProperties *      coreProperties,
   [in]            IXpsOMImageResource *       packageThumbnail,
   [in]            IXpsOMPrintTicketResource * documentSequencePrintTicket,
   [in]            IOpcPartUri *               discardControlPartName,
   [in]            XPS_DOCUMENT_TYPE           documentType,
   [out, retval]   IXpsOMPackageWriter **      packageWriter
);

Parameters

  • fileName
    [in] The name of the file to be created.

  • securityAttributes
    [in, unique] The SECURITY_ATTRIBUTES structure, which contains two separate but related members:

    • lpSecurityDescriptor: an optional security descriptor
    • bInheritHandle: a Boolean value that determines whether the returned handle can be inherited by child processes

    If lpSecurityDescriptor is NULL, the file or device associated with the returned handle is assigned a default security descriptor.

    For more information about securityAttributes, see CreateFile.

  • flagsAndAttributes
    [in] Specifies the settings and attributes of the file to be created. For most files, the FILE_ATTRIBUTE_NORMAL value can be used.

    See CreateFile for more information about this parameter.

  • optimizeMarkupSize
    [in] A Boolean value that indicates whether the document markup will be optimized for size when the contents of the XPS OM are written to the XPS package.

    Value Meaning
    TRUE

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

    FALSE

    The package writer will not try to perform any optimization.

     

  • interleaving
    [in] Specifies whether the content of the XPS OM will be interleaved when it is written to the file.

  • documentSequencePartName
    [in] The IOpcPartUri interface that contains the part name of the document sequence in the new file.

  • coreProperties
    [in] The IXpsOMCoreProperties interface that contains the core document properties to be given to the new file. This parameter can be set to NULL.

  • packageThumbnail
    [in] The IXpsOMImageResource interface that contains the thumbnail image to be assigned to the new file. This parameter can be set to NULL.

  • documentSequencePrintTicket
    [in] The IXpsOMPrintTicketResource interface that contains the package-level print ticket to be assigned to the new file. This parameter can be set to NULL.

  • discardControlPartName
    [in] The IOpcPartUri interface that contains the name of the discard control part. This parameter can be set to NULL.

  • documentType
    [in] Specifies the document type of the package writer. The value of this parameter cannot be XPS_DOCUMENT_TYPE_UNSPECIFIED.

  • packageWriter
    [out, retval] A pointer to the new IXpsOMPackageWriter interface created by this method.

Return value

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 and packageWriter was set correctly.

E_INVALIDARG: The document type was not a valid XPS document format.

Remarks

Use this method to produce a package writer for either an MSXPS document or an OpenXPS document. CreatePackageWriterOnFile, released in Windows 7, only creates XPS document files in the MSXPS format.

Additional References

Additional References: Legacy method description

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