using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using static Vanara.PInvoke.Ole32; using static Vanara.PInvoke.Opc; namespace Vanara.PInvoke { public static partial class XpsObjectModel { /// Creates objects in the XPS document object model. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nn-xpsobjectmodel-ixpsomobjectfactory [PInvokeData("xpsobjectmodel.h", MSDNShortId = "2444703e-4b89-4ef0-9ed7-aa937bc62e8c")] [ComImport, Guid("F9B2A685-A50D-4FC2-B764-B56E093EA0CA"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(XpsOMObjectFactory))] public interface IXpsOMObjectFactory { /// Creates an IXpsOMPackage interface that serves as the root node of an XPS object model document tree. /// A pointer to the new IXpsOMPackage interface. /// /// The code example that follows illustrates how this method is used to create a new interface. /// For information about using IXpsOMPackage interface in a program, see Create a Blank XPS OM. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackage HRESULT // CreatePackage( IXpsOMPackage **package ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPackage CreatePackage(); /// Opens an XPS package file and returns an instantiated XPS document object tree. /// The name of the XPS package file. /// /// /// A Boolean value that indicates whether the software is to attempt to optimize the document object tree by sharing objects /// that are identical in all properties and children. /// /// /// /// Value /// Meaning /// /// /// TRUE /// The software will attempt to optimize the object tree. /// /// /// FALSE /// The software will not attempt to optimize the object tree. /// /// /// /// A pointer to the new IXpsOMPackage interface that contains the resulting XPS document object tree. /// /// /// This method does not validate the contents of any stream-based resources that it loads from the stream into the objects of /// the XPS OM. Instead, the application must validate these resources before it uses them. /// /// /// This method does not deserialize the document pages; it only deserializes the XPS package down to the page reference parts. /// The actual pages can be deserialized as they are needed, by calling the IXpsOMPageReference::GetPage method. Because the /// pages are not deserialized when GetPage is called, it is possible for this method to return S_OK or, if an attempt is /// made to load a problematic page in an XPS package, to return an error. /// /// /// If you write an XPS OM immediately after you have read an XPS package into it, some of the original content might be lost or changed. /// /// Some of the changes that can occur in such a case are listed in the table that follows: /// /// /// Document feature /// Action /// /// /// Digital signatures /// Removed from document /// /// /// DiscardControl part /// Removed from document /// /// /// Foreign document parts /// Removed from document /// /// /// FixedPage markup /// Modified from original /// /// /// Resource dictionary markup /// Modified from original if Optimization flag is set /// /// /// For information about using IXpsOMPackage interface in a program, see Create a Blank XPS OM. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackagefromfile // HRESULT CreatePackageFromFile( LPCWSTR filename, BOOL reuseObjects, IXpsOMPackage **package ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPackage CreatePackageFromFile([In, MarshalAs(UnmanagedType.LPWStr)] string filename, [In, MarshalAs(UnmanagedType.Bool)] bool reuseObjects); /// Opens a stream that contains an XPS package, and returns an instantiated XPS document object tree. /// The stream that contains an XPS package. /// /// /// 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. /// /// /// /// Value /// Meaning /// /// /// TRUE /// The software will attempt to optimize the object tree. /// /// /// FALSE /// The software will not attempt to optimize the object tree. /// /// /// /// A pointer to the new IXpsOMPackage interface that contains the resulting XPS document object tree. /// /// /// This method does not validate the contents of any stream-based resources that it loads from the stream into the objects of /// the XPS OM. Instead, the application must validate these resources before it uses them. /// /// /// This method does not deserialize the document pages; it only deserializes the XPS package down to the page reference parts. /// The actual pages can be deserialized as they are needed, by calling the IXpsOMPageReference::GetPage method. Because the /// pages are not deserialized when GetPage is called, it is possible for this method to return S_OK or, if an attempt is /// made to load a problematic page in an XPS package, to return an error. /// /// /// If you write an XPS OM immediately after you have read an XPS package into it, some of the original content might be lost or changed. /// /// Some of the changes that can occur in such a case are listed in the table that follows: /// /// /// Document feature /// Action /// /// /// Digital signatures /// Removed from document /// /// /// DiscardControl part /// Removed from document /// /// /// Foreign document parts /// Removed from document /// /// /// FixedPage markup /// Modified from original /// /// /// Resource dictionary markup /// Modified from original if Optimization flag is set /// /// /// For information about using IXpsOMPackage interface in a program, see Create a Blank XPS OM. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackagefromstream // HRESULT CreatePackageFromStream( IStream *stream, BOOL reuseObjects, IXpsOMPackage **package ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPackage CreatePackageFromStream([In] IStream stream, [In, MarshalAs(UnmanagedType.Bool)] bool reuseObjects); /// /// Creates an IXpsOMStoryFragmentsResource interface that provides access to the content of the resource stream of a page's /// StoryFragments part. /// /// /// The read-only IStream interface to be associated with this StoryFragments resource. /// Important Treat this stream as a Single-Threaded Apartment (STA) object; do not re-enter it. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMStoryFragmentsResource interface. /// /// /// The StoryFragments part of a page contains the XML markup that describes the structure of the portions of one or more /// stories that are associated with a single fixed page. Some of the document contents that might be described by the XML /// markup in a StoryFragments part include the story's tables and paragraphs that are found on the page. /// /// The XML markup in the DocumentStructure and StoryFragments parts is described in the XML Paper Specification. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createstoryfragmentsresource // HRESULT CreateStoryFragmentsResource( IStream *acquiredStream, IOpcPartUri *partUri, IXpsOMStoryFragmentsResource // **storyFragmentsResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMStoryFragmentsResource CreateStoryFragmentsResource([In] IStream acquiredStream, [In] IOpcPartUri partUri); /// /// Creates an IXpsOMDocumentStructureResource interface, which provides access to the document structure resource stream. /// /// /// The read-only IStream interface to be associated with this resource. This parameter must not be NULL. /// /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not be NULL. /// /// A pointer to the new IXpsOMDocumentStructureResource interface. /// /// /// The DocumentStructure part of an XPS document contains the document outline, which, with the StoryFragments parts, defines /// the reading order of every element that appears in the fixed pages of the document. This interface enables a program to read /// the XML contents of the DocumentStructure part and also to replace the XML contents of the DocumentStructure part. /// /// /// The DocumentStructure part contains the document framework and the outline that describes the overall reading order of the /// document. The reading order is organized into semantic blocks called stories. Stories are logical units of the document in /// the same way as articles are units in a magazine. Stories are made up of one or more StoryFragments parts. /// /// /// The StoryFragments parts contain content structure markup that defines the story's semantic blocks, such as the paragraphs /// and tables that make up the story's content. /// /// The content of the DocumentStructure and StoryFragments parts is described in the XML Paper Specification. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createdocumentstructureresource // HRESULT CreateDocumentStructureResource( IStream *acquiredStream, IOpcPartUri *partUri, IXpsOMDocumentStructureResource // **documentStructureResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMDocumentStructureResource CreateDocumentStructureResource([In] IStream acquiredStream, [In] IOpcPartUri partUri); /// Creates an IXpsOMSignatureBlockResource that can contain one or more signature requests. /// A read-only stream to be associated with this resource. /// A pointer to the IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMSignatureBlockResource interface created by this method. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createsignatureblockresource // HRESULT CreateSignatureBlockResource( IStream *acquiredStream, IOpcPartUri *partUri, IXpsOMSignatureBlockResource // **signatureBlockResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMSignatureBlockResource CreateSignatureBlockResource([In] IStream acquiredStream, [In] IOpcPartUri partUri); /// Creates an IXpsOMRemoteDictionaryResource interface that enables the sharing of property resources. /// The IXpsOMDictionary interface pointer of the dictionary to be associated with this resource. /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMRemoteDictionaryResource interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createremotedictionaryresource // HRESULT CreateRemoteDictionaryResource( IXpsOMDictionary *dictionary, IOpcPartUri *partUri, IXpsOMRemoteDictionaryResource // **remoteDictionaryResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMRemoteDictionaryResource CreateRemoteDictionaryResource([In] IXpsOMDictionary dictionary, [In] IOpcPartUri partUri); /// Loads the remote resource dictionary markup into an unrooted IXpsOMRemoteDictionaryResource interface. /// The IStream interface that contains the remote resource dictionary markup. /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// /// The IXpsOMPartResources interface for the part resources of the dictionary resource objects that have streams. /// /// A pointer to the new IXpsOMRemoteDictionaryResource interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createremotedictionaryresourcefromstream // HRESULT CreateRemoteDictionaryResourceFromStream( IStream *dictionaryMarkupStream, IOpcPartUri *dictionaryPartUri, // IXpsOMPartResources *resources, IXpsOMRemoteDictionaryResource **dictionaryResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMRemoteDictionaryResource CreateRemoteDictionaryResourceFromStream([In] IStream dictionaryMarkupStream, [In] IOpcPartUri dictionaryPartUri, [In] IXpsOMPartResources resources); /// Creates an IXpsOMPartResources interface that can contain part-based resources. /// A pointer to the new IXpsOMPartResources interface. /// /// /// The part resources are shared between pages of a document and can include fonts, images, color profiles, and remote dictionaries. /// /// To find the part resources of a document, call IXpsOMPageReference::CollectPartResources. /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpartresources // HRESULT CreatePartResources( IXpsOMPartResources **partResources ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPartResources CreatePartResources(); /// Creates an IXpsOMDocumentSequence interface, which can contain the IXpsOMDocument interfaces of the XPS document. /// /// A pointer to the IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not /// be NULL. /// /// A pointer to the new IXpsOMDocumentSequence interface. /// /// /// 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 /// partUri or documentSequence is NULL. /// /// /// /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createdocumentsequence // HRESULT CreateDocumentSequence( IOpcPartUri *partUri, IXpsOMDocumentSequence **documentSequence ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMDocumentSequence CreateDocumentSequence([In] IOpcPartUri partUri); /// /// Creates an IXpsOMDocument interface, which can contain a set of IXpsOMPageReference interfaces in an ordered sequence. /// /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not be NULL. /// /// A pointer to the new IXpsOMDocument interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createdocument // HRESULT CreateDocument( IOpcPartUri *partUri, IXpsOMDocument **document ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMDocument CreateDocument([In] IOpcPartUri partUri); /// Creates an IXpsOMPageReference interface that enables the virtualization of pages. /// /// The XPS_SIZE structure that sets the advisory page dimensions (page width and page height). /// /// Size is described in XPS units. There are 96 XPS units per inch. For example, the dimensions of an 8.5" by 11.0" page are /// 816 by 1,056 XPS units. /// /// /// A pointer to the new IXpsOMPageReference interface. /// /// /// The use of a page reference makes it possible to delay the loading of the full object model of a page until the loading is /// requested explicitly. If the page has not been altered, it can be unloaded on request. /// /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpagereference // HRESULT CreatePageReference( const XPS_SIZE *advisoryPageDimensions, IXpsOMPageReference **pageReference ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPageReference CreatePageReference(in XPS_SIZE advisoryPageDimensions); /// /// Creates an IXpsOMPage interface, which provides the root node of a tree of objects that represent the contents of a single page. /// /// /// The XPS_SIZE structure that specifies the size of the page to be created. /// /// Size is described in XPS units. There are 96 XPS units per inch. For example, the dimensions of an 8.5" by 11.0" page are /// 816 by 1,056 XPS units. /// /// /// /// The string that indicates the default language of the created page. /// Important The language string must follow the RFC 3066 syntax. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMPage interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpage HRESULT // CreatePage( const XPS_SIZE *pageDimensions, LPCWSTR language, IOpcPartUri *partUri, IXpsOMPage **page ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPage CreatePage(in XPS_SIZE pageDimensions, [In, MarshalAs(UnmanagedType.LPWStr)] string language, [In] IOpcPartUri partUri); /// Reads the page markup from the specified stream to create and populate an IXpsOMPage interface. /// The stream that contains the page markup. /// The IOpcPartUri interface that contains the page's URI. /// The IXpsOMPartResources interface that contains the resources used by the page. /// /// /// A Boolean value that specifies whether the software is to attempt to optimize the page contents tree by sharing objects that /// are identical in all properties and children. /// /// /// /// Value /// Meaning /// /// /// TRUE /// The software will attempt to optimize the object tree. /// /// /// FALSE /// The software will not attempt to optimize the object tree. /// /// /// /// A pointer to the new IXpsOMPage interface created by this method. /// /// This method does not validate the contents of any stream-based resources that it loads from the stream into the document /// objects. The application must verify these resources before it uses them. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpagefromstream // HRESULT CreatePageFromStream( IStream *pageMarkupStream, IOpcPartUri *partUri, IXpsOMPartResources *resources, BOOL // reuseObjects, IXpsOMPage **page ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPage CreatePageFromStream([In] IStream pageMarkupStream, [In] IOpcPartUri partUri, [In] IXpsOMPartResources resources, [In, MarshalAs(UnmanagedType.Bool)] bool reuseObjects); /// Creates an IXpsOMCanvas interface that is used to group page elements. /// A pointer to the new IXpsOMCanvas interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createcanvas HRESULT // CreateCanvas( IXpsOMCanvas **canvas ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMCanvas CreateCanvas(); /// Creates an IXpsOMGlyphs interface, which specifies text that appears on a page. /// A pointer to the IXpsOMFontResource interface of the font resource to be used. /// The new IXpsOMGlyphs interface pointer. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createglyphs HRESULT // CreateGlyphs( IXpsOMFontResource *fontResource, IXpsOMGlyphs **glyphs ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMGlyphs CreateGlyphs([In] IXpsOMFontResource fontResource); /// Creates an IXpsOMPath interface that specifies a graphical path element on a page. /// A pointer to the new IXpsOMPath interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpath HRESULT // CreatePath( IXpsOMPath **path ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPath CreatePath(); /// Creates an IXpsOMGeometry interface, which specifies the shape of a path or of a clipping region. /// A pointer to the new IXpsOMGeometry interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-creategeometry // HRESULT CreateGeometry( IXpsOMGeometry **geometry ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMGeometry CreateGeometry(); /// /// Creates an IXpsOMGeometryFigure interface, which specifies a portion of an object that is defined by an IXpsOMGeometry interface. /// /// The coordinates of the starting point of the geometry figure. /// A pointer to the new IXpsOMGeometryFigure interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-creategeometryfigure // HRESULT CreateGeometryFigure( const XPS_POINT *startPoint, IXpsOMGeometryFigure **figure ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMGeometryFigure CreateGeometryFigure(in XPS_POINT startPoint); /// Creates an IXpsOMMatrixTransform interface that specifies an affine matrix transform. /// The initial matrix to be assigned to the transform. /// A pointer to the new IXpsOMMatrixTransform interface. /// /// The transform specified by this matrix can be applied to the transform property of other XPS objects. /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-creatematrixtransform // HRESULT CreateMatrixTransform( const XPS_MATRIX *matrix, IXpsOMMatrixTransform **transform ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMMatrixTransform CreateMatrixTransform(in XPS_MATRIX matrix); /// Creates an IXpsOMSolidColorBrush interface, which specifies a brush of a single, solid color. /// The XPS_COLOR structure that specifies the brush color. /// /// The IXpsOMColorProfileResource interface. Unless the color type is XPS_COLOR_TYPE_CONTEXT, this value must be NULL. /// /// A pointer to the new IXpsOMSolidColorBrush interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createsolidcolorbrush // HRESULT CreateSolidColorBrush( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile, IXpsOMSolidColorBrush // **solidColorBrush ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMSolidColorBrush CreateSolidColorBrush(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile); /// Creates an IXpsOMColorProfileResource interface, which is used to access a color profile resource stream. /// /// The read-only IStream interface to be associated with this resource. This parameter must not be NULL. /// Important Treat this stream as a Single-Threaded Apartment (STA) object; do not re-enter it. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMColorProfileResource interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createcolorprofileresource // HRESULT CreateColorProfileResource( IStream *acquiredStream, IOpcPartUri *partUri, IXpsOMColorProfileResource // **colorProfileResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMColorProfileResource CreateColorProfileResource([In] IStream acquiredStream, [In] IOpcPartUri partUri); /// Creates an IXpsOMImageBrush interface. /// The IXpsOMImageResource interface that contains the image to be used as the source image of the brush. /// /// The XPS_RECT structure that defines the viewbox, which is the area of the source image that is used by the brush. /// /// /// The XPS_RECT structure that defines the viewport, which is the area covered by the first tile in the output area. /// /// /// The brush's viewbox specifies the portion of a source image or visual to be used as the tile image. /// /// The coordinates of the brush's viewbox are relative to the source content, such that (0,0) specifies the upper-left corner /// of the source content. For images, dimensions specified by the brush's viewbox are expressed in the units of 1/96". The /// corresponding pixel coordinates in the source image are calculated as follows: /// /// /// In the illustration that follows, the image on the left is an example of a source image, and that on the far right is the /// brush that results after selecting the viewbox. /// /// /// If the source image resolution is 96 by 96 dots per inch and image dimensions are 96 by 96 pixels, the values of fields in /// the viewbox parameter are as follows: /// /// The preceding parameter values correspond to the source image as follows: /// /// An image brush is a tile brush that takes an image, or a part of it, transforms the image to create a tile, places the /// resulting tile in the viewport (the destination geometry of the tile in the output area), and fills the output area as /// described by the tile mode. /// /// /// The viewport is the area covered by the first tile in the output area. The viewport image is repeated throughout the output /// area as described by the tile mode. /// /// /// The next illustration shows how an image brush is used to fill an output area. From left to right, the original image is /// transformed to fill the viewport, then placed in the viewport area of the output area, and then tiled to fill the output area. /// /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createimagebrush // HRESULT CreateImageBrush( IXpsOMImageResource *image, const XPS_RECT *viewBox, const XPS_RECT *viewPort, IXpsOMImageBrush // **imageBrush ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMImageBrush CreateImageBrush([In] IXpsOMImageResource image, in XPS_RECT viewBox, in XPS_RECT viewPort); /// Creates an IXpsOMVisualBrush interface, which is an IXpsOMTileBrush that uses a visual object. /// /// The XPS_RECT structure that specifies the source image's area to be used in the brush. This parameter must not be NULL. /// /// /// The XPS_RECT structure that specifies the destination geometry area of the tile. This parameter must not be NULL. /// /// A pointer to the new IXpsOMVisualBrush interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createvisualbrush // HRESULT CreateVisualBrush( const XPS_RECT *viewBox, const XPS_RECT *viewPort, IXpsOMVisualBrush **visualBrush ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMVisualBrush CreateVisualBrush(in XPS_RECT viewBox, in XPS_RECT viewPort); /// Creates an IXpsOMImageResource interface, which is used to access an image resource stream. /// /// The read-only stream to be associated with this resource. This parameter must not be NULL. /// Important Treat this stream as a Single-Threaded Apartment (STA) object; do not re-enter it. /// /// The XPS_IMAGE_TYPE value that describes the image type of the stream that is referenced by acquiredStream. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not be NULL. /// /// A pointer to the new IXpsOMImageResource interface. /// The code example that follows illustrates how this method is used to create a new interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createimageresource // HRESULT CreateImageResource( IStream *acquiredStream, XPS_IMAGE_TYPE contentType, IOpcPartUri *partUri, IXpsOMImageResource // **imageResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMImageResource CreateImageResource([In] IStream acquiredStream, [In] XPS_IMAGE_TYPE contentType, [In] IOpcPartUri partUri); /// Creates an IXpsOMPrintTicketResource interface that enables access to a PrintTicket stream. /// /// The read-only PrintTicket resource stream. /// Important Treat this stream as a Single-Threaded Apartment (STA) object; do not re-enter it. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. /// A pointer to the new IXpsOMPrintTicketResource interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createprintticketresource // HRESULT CreatePrintTicketResource( IStream *acquiredStream, IOpcPartUri *partUri, IXpsOMPrintTicketResource // **printTicketResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPrintTicketResource CreatePrintTicketResource([In] IStream acquiredStream, [In] IOpcPartUri partUri); /// Creates an IXpsOMFontResource interface, which provides an IStream interface to the font resource. /// /// The read-only IStream interface to be associated with this font resource. This parameter must not be NULL. /// Important Treat this stream as a Single-Threaded Apartment (STA) object; do not re-enter it. /// Caution This stream is not to be obfuscated. /// /// The XPS_FONT_EMBEDDING value that specifies the stream's embedding option. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not be NULL. /// /// /// A Boolean value that indicates whether the stream referenced by acquiredStream is obfuscated. /// /// /// Value /// Meaning /// /// /// TRUE /// The stream referenced by acquiredStream is obfuscated. /// /// /// FALSE /// The stream referenced by acquiredStream is not obfuscated. /// /// /// /// A pointer to the new IXpsOMFontResource interface. /// /// /// The value of isObfSourceStream describes the state of the acquiredStream-referenced stream at the time the font resource is /// created. All subsequent calls to GetStream or SetContent will operate on unobfuscated versions of IStream. /// /// /// An error is returned if isObfSourceStream is set to TRUE and fontEmbedding is set to XPS_FONT_EMBEDDING_NORMAL, or if /// the name referenced by partUri does not conform to the syntax for obfuscated streams. /// /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createfontresource // HRESULT CreateFontResource( IStream *acquiredStream, XPS_FONT_EMBEDDING fontEmbedding, IOpcPartUri *partUri, BOOL // isObfSourceStream, IXpsOMFontResource **fontResource ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMFontResource CreateFontResource([In] IStream acquiredStream, [In] XPS_FONT_EMBEDDING fontEmbedding, [In] IOpcPartUri partUri, [In, MarshalAs(UnmanagedType.Bool)] bool isObfSourceStream); /// Creates an IXpsOMGradientStop interface to represent a single color and location definition within a gradient. /// The color value. /// /// A pointer to the IXpsOMColorProfileResource interface that contains the color profile to be used. If the color type is not /// XPS_COLOR_TYPE_CONTEXT, this parameter must be NULL. /// /// /// The offset value. /// Valid range: 0.0–1.0 /// /// A pointer to the new IXpsOMGradientStop interface. /// /// /// Gradient stops are used to define the color at a specific location; the color is interpolated between the gradient stops. /// The offset, which is specified by offset, is a relative position between the start and end points of the gradient. The /// offset at the start point of a linear gradient or the origin of a radial gradient is 0.0. The offset of the end point of a /// linear gradient or the bounding ellipse of a radial gradient is 1.0. Gradient stops can be specified for any offset between /// those points, including the start and end points. The following illustration shows the gradient path and gradient stops of a /// linear gradient. /// /// /// The following illustration shows the gradient stops of a radial gradient. In this example, the radial gradient region is the /// area enclosed by the outer ellipse and the XPS_SPREAD_METHOD_REFLECT spread method is used to fill the space outside /// of the gradient region. /// /// The IXpsOMGradientStop interface specifies one and only one stop in a gradient. /// The calculations used to render a gradient are described in the XML Paper Specification. /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-creategradientstop // HRESULT CreateGradientStop( const XPS_COLOR *color, IXpsOMColorProfileResource *colorProfile, FLOAT offset, // IXpsOMGradientStop **gradientStop ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMGradientStop CreateGradientStop(in XPS_COLOR color, [In] IXpsOMColorProfileResource colorProfile, [In] float offset); /// Creates an IXpsOMLinearGradientBrush interface. /// /// The IXpsOMGradientStop interface that specifies the gradient properties at the beginning of the gradient's vector. This /// parameter must not be NULL. /// /// /// The IXpsOMGradientStop interface that specifies the gradient properties at the end of the gradient's vector. This parameter /// must not be NULL. /// /// The XPS_POINT structure that contains the coordinates of the start point in two-dimensional space. /// The XPS_POINT structure that contains the coordinates of the end point in two-dimensional space. /// A pointer to the new IXpsOMLinearGradientBrush interface. /// /// /// The gradient region of a linear gradient is the area between and including the start and end points and extending in both /// directions at a right angle to the gradient path. The spread area is the area of the geometry that lies outside the gradient region. /// /// /// Gradient stops define the color at specific locations along the gradient path. In the illustration, gradient stop 0, /// specified by the gradStop1 parameter, is located at the start point of the gradient path, and gradient stop 1, specified by /// the gradStop2 parameter, is at the end point. /// /// /// As shown in the illustration that follows, the start and end points of a linear gradient are also the start and end points /// of the gradient path, which is the straight line that connects those points. /// /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createlineargradientbrush // HRESULT CreateLinearGradientBrush( IXpsOMGradientStop *gradStop1, IXpsOMGradientStop *gradStop2, const XPS_POINT *startPoint, // const XPS_POINT *endPoint, IXpsOMLinearGradientBrush **linearGradientBrush ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMLinearGradientBrush CreateLinearGradientBrush([In] IXpsOMGradientStop gradStop1, [In] IXpsOMGradientStop gradStop2, in XPS_POINT startPoint, in XPS_POINT endPoint); /// Creates an IXpsOMRadialGradientBrush interface. /// /// The IXpsOMGradientStop interface that specifies the properties of the gradient at gradient origin. This parameter must not /// be NULL. /// /// /// The IXpsOMGradientStop interface that specifies the properties of the gradient at the end of the gradient's vector, which is /// the ellipse that encloses the gradient region. This parameter must not be NULL. /// /// The coordinates of the center point of the radial gradient ellipse. /// The coordinates of the origin of the radial gradient. /// /// The XPS_SIZE structure whose members specify the lengths of the gradient region's radii. /// Size is described in XPS units. There are 96 XPS units per inch. For example, a 1" radius is 96 XPS units. /// /// /// XPS_SIZE Member /// Meaning /// /// /// width /// Length of the radius along the x-axis. /// /// /// height /// Length of the radius along the y-axis. /// /// /// /// A pointer to the new IXpsOMRadialGradientBrush interface. /// /// /// As shown in the following illustration, the gradient region of a radial gradient is the area enclosed by the ellipse that is /// described by the center point and the x and y radii that extend from the center point. The spread area is the area outside /// of that ellipse. The gradient path (not shown) is a radial line that is drawn between the gradient origin and the ellipse /// that bounds the gradient region. /// /// /// For radial-gradient brushes, the gradient stop that is set by the gradStop1 parameter corresponds to the gradient origin /// location and an offset value of 0.0. The gradient stop that is set by the gradStop2 parameter corresponds to the /// circumference of the gradient region and an offset value of 1.0. For more information on gradient stops, see IXpsOMGradientStop. /// /// The code example that follows illustrates how this method is used to create a new interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createradialgradientbrush // HRESULT CreateRadialGradientBrush( IXpsOMGradientStop *gradStop1, IXpsOMGradientStop *gradStop2, const XPS_POINT // *centerPoint, const XPS_POINT *gradientOrigin, const XPS_SIZE *radiiSizes, IXpsOMRadialGradientBrush **radialGradientBrush ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMRadialGradientBrush CreateRadialGradientBrush([In] IXpsOMGradientStop gradStop1, [In] IXpsOMGradientStop gradStop2, in XPS_POINT centerPoint, in XPS_POINT gradientOrigin, in XPS_SIZE radiiSizes); /// Creates an IXpsOMCoreProperties interface, which contains the metadata that describes an XPS document. /// /// The IOpcPartUri interface that contains the part name to be assigned to this resource. This parameter must not be NULL. /// /// A pointer to the new IXpsOMCoreProperties interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createcoreproperties // HRESULT CreateCoreProperties( IOpcPartUri *partUri, IXpsOMCoreProperties **coreProperties ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMCoreProperties CreateCoreProperties([In] IOpcPartUri partUri); /// Creates an IXpsOMDictionary interface, which enables the sharing of property resources. /// A pointer to the new IXpsOMDictionary interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createdictionary // HRESULT CreateDictionary( IXpsOMDictionary **dictionary ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMDictionary CreateDictionary(); /// Creates an IXpsOMPartUriCollection interface that can contain IOpcPartUri interface pointers. /// A pointer to the new IXpsOMPartUriCollection interface. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createparturicollection // HRESULT CreatePartUriCollection( IXpsOMPartUriCollection **partUriCollection ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPartUriCollection CreatePartUriCollection(); /// Opens a file for writing the contents of an XPS OM to an XPS package. /// The name of the file to be created. /// /// 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. /// /// /// /// 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. /// /// /// /// 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. /// /// /// /// Specifies whether the content of the XPS OM will be interleaved when it is written to the file. /// /// The IOpcPartUri interface that contains the part name of the document sequence in the new file. /// /// /// The IXpsOMCoreProperties interface that contains the core document properties to be given to the new file. This parameter /// can be set to NULL. /// /// /// The IXpsOMImageResource interface that contains the thumbnail image to be assigned to the new file. This parameter can be /// set to NULL. /// /// /// The IXpsOMPrintTicketResource interface that contains the package-level print ticket to be assigned to the new file. This /// parameter can be set to NULL. /// /// /// The IOpcPartUri interface that contains the name of the discard control part. This parameter can be set to NULL. /// /// A pointer to the new IXpsOMPackageWriter interface created by this method. /// /// /// The file is opened and initialized and the IXpsOMPackageWriter interface that is returned is then used to write content /// types, package relationships, core properties, document sequence resources, and document sequence relationships. /// /// /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_ON, this /// method creates a blank job-level print ticket and adds a relationship to the blank print ticket. This is done to provide /// more efficient streaming consumption of the package. /// /// /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_OFF, no blank /// print ticket is created. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackagewriteronfile // HRESULT CreatePackageWriterOnFile( LPCWSTR fileName, LPSECURITY_ATTRIBUTES securityAttributes, DWORD flagsAndAttributes, BOOL // optimizeMarkupSize, XPS_INTERLEAVING interleaving, IOpcPartUri *documentSequencePartName, IXpsOMCoreProperties // *coreProperties, IXpsOMImageResource *packageThumbnail, IXpsOMPrintTicketResource *documentSequencePrintTicket, IOpcPartUri // *discardControlPartName, IXpsOMPackageWriter **packageWriter ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPackageWriter CreatePackageWriterOnFile([In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] IntPtr securityAttributes, [In] uint flagsAndAttributes, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, [In] IOpcPartUri documentSequencePartName, [In] IXpsOMCoreProperties coreProperties, [In] IXpsOMImageResource packageThumbnail, [In] IXpsOMPrintTicketResource documentSequencePrintTicket, [In] IOpcPartUri discardControlPartName); /// Opens a stream for writing the contents of an XPS OM to an XPS package. /// The stream to be used for writing. /// /// /// A Boolean value that indicates whether the document markup will be optimized for size when the document is written to the stream. /// /// /// /// Value /// Meaning /// /// /// TRUE /// When writing to the stream, the package writer will attempt to optimize the markup for minimum size. /// /// /// FALSE /// When writing to the package, the package writer will not attempt any optimization. /// /// /// /// Specifies whether the content of the XPS OM will be interleaved when it is written to the stream. /// /// The IOpcPartUri interface that contains the part name of the document sequence in the new file. /// /// /// The IXpsOMCoreProperties interface that contains the core document properties to be given to the new file. This parameter /// can be set to NULL. /// /// /// The IXpsOMImageResource interface that contains the thumbnail image to be assigned to the new file. This parameter can be /// set to NULL. /// /// /// The IXpsOMPrintTicketResource interface that contains the package-level print ticket to be assigned to the new file. This /// parameter can be set to NULL. /// /// /// The IOpcPartUri interface that contains the name of the discard control part. This parameter can be set to NULL. /// /// A pointer to the new IXpsOMPackageWriter interface created by this method. /// /// /// The stream is opened and initialized, and then the returned IXpsOMPackageWriter interface is used to write content types, /// package relationships, core properties, document sequence resources, and document sequence relationships. /// /// /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_ON, this /// method creates a blank job-level print ticket and adds a relationship to the blank print ticket. This is done to provide /// more efficient streaming consumption of the package. /// /// /// If documentSequencePrintTicket is set to NULL and the value of interleaving is XPS_INTERLEAVING_OFF, no blank /// print ticket is created. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createpackagewriteronstream // HRESULT CreatePackageWriterOnStream( ISequentialStream *outputStream, BOOL optimizeMarkupSize, XPS_INTERLEAVING interleaving, // IOpcPartUri *documentSequencePartName, IXpsOMCoreProperties *coreProperties, IXpsOMImageResource *packageThumbnail, // IXpsOMPrintTicketResource *documentSequencePrintTicket, IOpcPartUri *discardControlPartName, IXpsOMPackageWriter // **packageWriter ); [MethodImpl(MethodImplOptions.InternalCall)] IXpsOMPackageWriter CreatePackageWriterOnStream([In] ISequentialStream outputStream, [In] int optimizeMarkupSize, [In] XPS_INTERLEAVING interleaving, [In] IOpcPartUri documentSequencePartName, [In] IXpsOMCoreProperties coreProperties, [In] IXpsOMImageResource packageThumbnail, [In] IXpsOMPrintTicketResource documentSequencePrintTicket, [In] IOpcPartUri discardControlPartName); /// Creates an IOpcPartUri interface that uses the specified URI. /// The URI string. /// A pointer to the IOpcPartUri interface created by this method. // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createparturi HRESULT // CreatePartUri( LPCWSTR uri, IOpcPartUri **partUri ); [MethodImpl(MethodImplOptions.InternalCall)] IOpcPartUri CreatePartUri([In, MarshalAs(UnmanagedType.LPWStr)] string uri); /// Creates a read-only IStream over the specified file. /// The name of the file to be opened. /// A stream over the specified file. /// /// CreateReadOnlyStreamOnFile is a wrapper method for IOpcFactory::CreateStreamOnFile. It has the same effect as calling /// the following: /// // https://docs.microsoft.com/en-us/windows/win32/api/xpsobjectmodel/nf-xpsobjectmodel-ixpsomobjectfactory-createreadonlystreamonfile // HRESULT CreateReadOnlyStreamOnFile( LPCWSTR filename, IStream **stream ); [MethodImpl(MethodImplOptions.InternalCall)] IStream CreateReadOnlyStreamOnFile([In, MarshalAs(UnmanagedType.LPWStr)] string filename); } /// CoClass for IXpsOMObjectFactory. [PInvokeData("xpsobjectmodel.h", MSDNShortId = "2444703e-4b89-4ef0-9ed7-aa937bc62e8c")] [ClassInterface(ClassInterfaceType.None), ComImport, Guid("E974D26D-3D9B-4D47-88CC-3872F2DC3585")] public class XpsOMObjectFactory { } } }