XPS Document Errors

The following table lists all the HRESULT values that can be returned by the methods of the XPS Document API. Note that not every method returns every return value that is listed in this table.

Return code/value Description
XPS_E_ALREADY_OWNED
0x80520503
The interface already has an owner.
XPS_E_BLEED_BOX_PAGE_DIMENSIONS_NOT_IN_SYNC
0x80520509
The bleed box dimensions are not compatible with the page dimensions.
The bleed box width value must be greater than or equal to the page width plus the absolute value of the x-coordinate of the bleed box origin. The bleed box height value must be greater than or equal to the page height plus the absolute value of the y-coordinate of the bleed box origin.
XPS_E_BOTH_PATHFIGURE_AND_ABBR_SYNTAX_PRESENT
0x80520507
A PathGeometry element contains a set of path figures that are specified either with the Figures attribute or with a child PathFigure element. The path figures of a geometry cannot have both the Figures attribute and a child PathFigure element.
XPS_E_BOTH_RESOURCE_AND_SOURCEATTR_PRESENT
0x80520508
A ResourceDictionary element that specifies a remote resource dictionary in its Source attribute MUST NOT contain any resource definition children.
XPS_E_CARET_OUT_OF_ORDER
0x80520306
A caret location value is out of order. The location values must be sorted in ascending order.
XPS_E_CARET_OUTSIDE_STRING
0x80520305
Caret stops were specified for an empty string; or, the caret jump index has exceeded the length of the Unicode string.
XPS_E_COLOR_COMPONENT_OUT_OF_RANGE
0x80520506
A color value is out of range.
For XPS_COLOR_TYPE_SCRGB color types, the alpha channel value must be greater than or equal to 0.0 and less than or equal to +1.0.
For XPS_COLOR_TYPE_CONTEXT color types, the channelValues[0] that represents the alpha channel value must be greater than or equal to 0.0 and less than or equal to +1.0.
XPS_E_DICTIONARY_ITEM_NAMED
0x80520401
A visual in a resource dictionary has the Name attribute, which may not be specified on any children of a ResourceDictionary element.
XPS_E_DUPLICATE_NAMES
0x80520209
An object with this name already exists in the dictionary.
XPS_E_DUPLICATE_RESOURCE_KEYS
0x80520200
An object with this key name already exists in the dictionary.
XPS_E_INDEX_OUT_OF_RANGE
0x80520500
Reserved.
XPS_E_INVALID_BLEED_BOX
0x80520004
The bleed box rectangle contains one or more values that are not valid. See the parameter description for the valid values.
XPS_E_INVALID_CONTENT_BOX
0x8052000b
The content box rectangle contains one or more values that are not valid. See the parameter description for the valid values.
XPS_E_INVALID_CONTENT_TYPE
0x8052000e
The content type string is not valid.
XPS_E_INVALID_FLOAT
0x80520007
A FLOAT value is not valid. It is either an infinite or not a number (NAN).
XPS_E_INVALID_FONT_URI
0x8052000a
The font URI is not valid, possibly because it contains an empty fragment or characters that are not valid.
XPS_E_INVALID_LANGUAGE
0x80520000
The specified language is either not valid or not correctly formatted.
XPS_E_INVALID_LOOKUP_TYPE
0x80520006
The lookup key name references an object that is not the correct type for the call; for example, if the method returns a brush but the lookup key name refers to a geometry object.
XPS_E_INVALID_MARKUP
0x8052000c
The markup being read contains an element or an attribute that does not conform to the XML Paper Specification.
Note: To represent floating-point values, the XPS OM uses the FLOAT data type instead of DOUBLE. If an XPS document has an element with floating-point data that does not fit into a FLOAT value, this error will be returned when that value is encountered during deserialization.
XPS_E_INVALID_NAME
0x80520001
The string that was passed is not a valid name, according to the XML Paper Specification.
XPS_E_INVALID_OBFUSCATED_FONT_URI
0x8052000f
Reserved.
XPS_E_INVALID_PAGE_SIZE
0x80520003
The page dimensions contain a page size value that is not valid.
XPS_E_INVALID_RESOURCE_KEY
0x80520002
According to the XML Paper Specification, the lookup key string is not valid.
XPS_E_INVALID_THUMBNAIL_IMAGE_TYPE
0x80520005
The thumbnail image type is not supported.
XPS_E_INVALID_XML_ENCODING
0x8052000d
Found improper or incorrectly formatted XML markup.
XPS_E_MAPPING_OUT_OF_ORDER
0x80520302
In one or more XPS_GLYPH_MAPPING structures, an element is out of sequence.
XPS_E_MAPPING_OUTSIDE_INDICES
0x80520304
The glyph mappings exceed the number of glyph indices.
XPS_E_MAPPING_OUTSIDE_STRING
0x80520303
Error in the glyph mappings.
If the Unicode string is empty, this error means that a glyph mapping was also defined. Glyph mappings must not be defined if the Unicode string is empty.
If the Unicode string is not empty, this error means that a glyph mapping was defined for glyphs outside of the Unicode string. Glyph mappings cannot be defined for glyphs that fall outside the length of the Unicode string.
XPS_E_MISSING_COLORPROFILE
0x80520104
The color profile parameter is NULL, but a color profile is expected. A color profile is required when the color type is XPS_COLOR_TYPE_CONTEXT.
XPS_E_MISSING_DISCARDCONTROL
0x80520112
A page refers to discardable resources but does not specify a DiscardControl part name.
XPS_E_MISSING_DOCUMENT
0x80520109
IXpsOMPackageWriter::AddPage was called before IXpsOMPackageWriter::StartNewDocument.
XPS_E_MISSING_DOCUMENTSEQUENCE_RELATIONSHIP
0x80520108
The package does not contain a FixedDocumentSequence.
XPS_E_MISSING_FONTURI
0x80520107
The IXpsOMGlyphs interface requires a font URI, but one is not specified.
XPS_E_MISSING_GLYPHS
0x80520102
The IXpsOMGlyphs interface without a Unicode string does not specify any glyph indices. An IXpsOMGlyphs interface must specify either a Unicode string or an array of glyph indices.
XPS_E_MISSING_IMAGE_IN_IMAGEBRUSH
0x8052010e
An image resource could not be located for the image brush.
XPS_E_MISSING_LOOKUP
0x80520101
The remote resource has an unexpected object.
XPS_E_MISSING_NAME
0x80520100
The page has not been named; the hyperlink target status can only be set if the page has a name.
XPS_E_MISSING_PAGE_IN_DOCUMENT
0x8052010c
The FixedDocument does not contain any FixedPage parts. An XPS document must contain at least one FixedPage part.
XPS_E_MISSING_PAGE_IN_PAGEREFERENCE
0x8052010d
The page reference does not have a corresponding page.
XPS_E_MISSING_PART_REFERENCE
0x80520110
A required target part was not referenced.
XPS_E_MISSING_PART_STREAM
0x80520113
A stream was not specified for the resource.
XPS_E_MISSING_REFERRED_DOCUMENT
0x8052010a
The FixedDocument part that is referenced by the FixedDocumentSequence could not be found. An XPS document must contain at least one FixedDocument.
XPS_E_MISSING_REFERRED_PAGE
0x8052010b
The FixedPage part that is referenced by the FixedDocument could not be found. An XPS document must contain at least one FixedPage part.
XPS_E_MISSING_RELATIONSHIP_TARGET
0x80520105
The relationship target part is not present in the package relationship.
XPS_E_MISSING_RESOURCE_KEY
0x8052010f
No x:Key attribute was specified for the resource.
XPS_E_MISSING_RESOURCE_RELATIONSHIP
0x80520106
The resource referred to by the page or remote dictionary content does not exist as a page relationship.
XPS_E_MISSING_RESTRICTED_FONT_RELATIONSHIP
0x80520111
The referenced restricted font was not specified in the call to IXpsOMPackageWriter::StartNewDocument.
XPS_E_MISSING_SEGMENT_DATA
0x80520103
The segment data array has fewer entries than the segment types array.
XPS_E_MULTIPLE_DOCUMENTSEQUENCE_RELATIONSHIPS
0x80520202
An attempt was made to add a FixedDocumentSequence to a package that already has one. An XPS document must contain one and only one FixedDocumentSequence part.
XPS_E_MULTIPLE_PRINTTICKETS_ON_DOCUMENT
0x80520206
An attempt was made to add a document-level print ticket to a FixedDocument that already has one. A FixedDocument in an XPS document can contain only one document-level print ticket.
XPS_E_MULTIPLE_PRINTTICKETS_ON_DOCUMENTSEQUENCE
0x80520207
An attempt was made to add a job-level print ticket to a FixedDocumentSequence that already has one. The FixedDocumentSequence in an XPS document can contain only one job-level print ticket.
XPS_E_MULTIPLE_PRINTTICKETS_ON_PAGE
0x80520205
An attempt was made to add a page-level print ticket to a FixedPage that already has one. A FixedPage in an XPS document can contain only one page-level print ticket.
XPS_E_MULTIPLE_REFERENCES_TO_PART
0x80520208
The restricted font collection contained a restricted font entry that was repeated. Each font entry can occur in the collection only once.
XPS_E_MULTIPLE_RESOURCES
0x80520201
A resource by that part name already exists.
XPS_E_MULTIPLE_THUMBNAILS_ON_PACKAGE
0x80520204
An attempt was made to add a thumbnail image to a package that already has one. An XPS document can contain only one package-level thumbnail image.
XPS_E_MULTIPLE_THUMBNAILS_ON_PAGE
0x80520203
An attempt was made to add a page-level thumbnail image to a FixedPage that already has one. A FixedPage in an XPS document can contain only one page-level thumbnail image.
XPS_E_NEGATIVE_FLOAT
0x8052030a
An entry contains a negative value, but it must contain a non-negative value.
XPS_E_NESTED_REMOTE_DICTIONARY
0x80520402
An attempt was made to add a remote dictionary reference to a remote dictionary. A remote dictionary cannot reference another remote dictionary.
XPS_E_NO_CUSTOM_OBJECTS
0x80520502
An interface pointer does not point to a recognized interface implementation. Custom implementation of XPS Document API interfaces is not supported.
XPS_E_NOT_ENOUGH_GRADIENT_STOPS
0x8052050b
The gradient stop collection has fewer than two stops. A gradient stop collection must have at least two gradient stops.
XPS_E_ODD_BIDILEVEL
0x80520307
The text string was specified as being oriented sideways and right-to-left. If the text is oriented sideways, it cannot have a bidi level that is an odd value (right-to-left). Likewise, if the bidi level is an odd value, the text cannot be oriented sideways.
XPS_E_ONE_TO_ONE_MAPPING_EXPECTED
0x80520308
The glyph mappings do not match the Unicode string contents.
XPS_E_PACKAGE_WRITER_NOT_CLOSED
0x8052050c
The package writer was not closed before it was released.
XPS_E_RELATIONSHIP_EXTERNAL
0x8052050a
A relationship refers to a part that is outside of the XPS document. All content to be rendered in an XPS document must be contained in the XPS document.
XPS_E_RESOURCE_NOT_OWNED
0x80520504
Reserved.
XPS_E_RESTRICTED_FONT_NOT_OBFUSCATED
0x80520309
Reserved.
XPS_E_STRING_TOO_LONG
0x80520300
A size_t overflow occurred during an attempt to copy a string into a new buffer.
XPS_E_TOO_MANY_INDICES
0x80520301
There were more glyph indices than Unicode code points. If there are no glyph mappings, the number of glyph indices must be less than or equal to the number of Unicode code points.
XPS_E_UNAVAILABLE_PACKAGE
0x80520114
A severe error occurred and the contents of the XPS OM might be unrecoverable. Some components of the XPS OM might still be usable, but they will need to be verified before being used further. Because the state of the XPS OM cannot be predicted after this error is returned, all components of the XPS OM should be released and discarded.
XPS_E_UNEXPECTED_COLORPROFILE
0x80520505
A color profile was present when one was not expected. A color profile is only allowed when the color type is XPS_COLOR_TYPE_CONTEXT.
XPS_E_UNEXPECTED_CONTENT_TYPE
0x80520008
The target of a relationship is not the type expected by the context of the relationship.
XPS_E_UNEXPECTED_RELATIONSHIP_TYPE
0x80520010
The relationship type was not recognized.
XPS_E_UNEXPECTED_RESTRICTED_FONT_RELATIONSHIP
0x80520011
The restricted font collection contains an unrestricted font.
XPS_E_VISUAL_CIRCULAR_REF
0x80520501
Reserved.
XPS_E_XKEY_ATTR_PRESENT_OUTSIDE_RES_DICT
0x80520400
A path geometry that is not in a resource dictionary has an x:Key attribute specified. Path geometries that are not in a resource dictionary cannot have an x:Key attribute.

Remarks

Some XPS document API methods make calls to the Packaging API. For information about the Packaging API return values, see Packaging Errors.

Requirements

Requirement Value
Minimum supported client
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Header
Xpsobjectmodel.h
IDL
XpsObjectModel.idl

See also

Error Handling in COM