IDocumentCreatorDocument

class IDocumentCreatorDocument

Bases: ImpactCOMWrapperBase

Description:

Represents a document used with the IDocumentCreator.

Remarks:

The IDocumentCreatorDocument object represents either a local file that will be added to the document repository or an existing IDocument object that will have new document relationships added. You can modify the properties, Values and add_relationship to each document before it is added to the document repository. Use the get_thumbnail_file method to generate thumbnail images for each document if required. Introduced in Impact 9.0.0.83.

Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance

property auto_relationship

Gets auto_relationship.

Description:

Allows the default relationship type to be overridden.

Remarks:

Introduced in Impact 11.0.0.7

Returns:

The value of auto_relationship.

Return type:

auto_relationship (ipDocumentCreatorAutoRelationship)

property description

Gets Description.

Description:

A description for the document.

Remarks:

For an existing document this property is read-only.

Returns:

The value of Description.

Return type:

description (str)

property display_id

Gets display_id.

Description:

An identifier for the document that can be displayed to a user.

Remarks:

For a local file the identifier takes the form ‘file://[file_path]’ For a file extracted from a local file (such as a zip file) the identifier takes the form ‘file://[temporary_file_path]’ where the contents of the zip file have been extracted to a temporary location. For an existing document the identifier takes the form ‘Existing Document: [Name], Version: [Version]’.

Returns:

The value of display_id.

Return type:

display_id (str)

property document

Gets Document.

Description:

Gets the IDocument object this document represents.

Remarks:

For an existing document this property returns the IDocument that this document references. For a local file this property will return null. For a local file after using the Perform method this property will return the IDocument that was created in the document repository, or null if no document was created.

Returns:

The value of Document.

Return type:

document (IDocument)

property extracted_meta_data

Gets extracted_meta_data.

Description:

Gets the meta-data values that were extracted from a local file.

Remarks:

For an existing document this property always returns an IDatabaseValues object containing no values.

Returns:

The value of extracted_meta_data.

Return type:

extracted_meta_data (IDatabaseValues)

property group

Gets Group.

Description:

The IDocumentGroup of the document.

Remarks:

For an existing document this property is read-only.

Returns:

The value of Group.

Return type:

group (IDocumentGroup)

property guid

Gets GUID.

Description:

A unique identifier for this IDocumentCreatorDocument object.

Remarks:

This GUID is temporary and is not the same value as the IDocument.id property. This GUID can be used when calling the IDocumentCreator.remove method.

Returns:

The value of GUID.

Return type:

guid (str)

property id

Gets ID.

Description:

An identifier for the document.

Remarks:

For a local file the identifier takes the form ‘file://[file_path]’ For a file extracted from a local file (such as a zip file) the identifier takes the form ‘file://[zip_file]$[file_path]’. For an existing document the identifier takes the form ‘doc://[IDocument.id]’

Returns:

The value of ID.

Return type:

id (str)

property initial_version

Gets initial_version.

Description:

Determines whether the document will be a major or minor version when created.

Remarks:

For an existing document this property is ignored. Check supports_major_and_minor_versions to determine if using dvMinor for the initial_version is appropriate.

Returns:

The value of initial_version.

Return type:

initial_version (ipDocumentVersion)

property local_file_path

Gets local_file_path.

Description:

The full local file path for a document.

Remarks:

For a file extracted from another file (such as a zip file) this path will be a temporary file located on the workstation. For an existing document this property always returns an empty string.

Returns:

The value of local_file_path.

Return type:

local_file_path (str)

property mime_type

Gets mime_type.

Description:

The IDocumentMIMEType of the document.

Remarks:

For local files the IDocumentMIMEType is automatically determined based on the files extension.

Returns:

The value of mime_type.

Return type:

mime_type (IDocumentMIMEType)

property name

Gets Name.

Description:

The name of the document.

Remarks:

For an existing document this property is read-only.

Returns:

The value of Name.

Return type:

name (str)

property page_count

Gets page_count.

Description:

The number of pages contained in the document file.

Remarks:

This property will only return a value other than 1 if the associated MIME type has a valid IMetaDataExtractor and the meta-data extractor supports determining the files page count.

Returns:

The value of page_count.

Return type:

page_count (int)

property relationship_count

Gets relationship_count.

Description:

The number of relationships in this collection.

Returns:

The value of relationship_count.

Return type:

relationship_count (int)

property size

Gets Size.

Description:

The size in bytes of the file data for this document.

Returns:

The value of Size.

Return type:

size (int)

property tags

Gets Tags.

Description:

The tags associated with this document.

Remarks:

The IDocumentTagsForDocument object can be used to associate tags with a document. For an existing document using this property will result in an error, instead use the Document.tags property directly.

Returns:

The value of Tags.

Return type:

tags (IDocumentTagsForDocument)

property type

Gets Type.

Description:

The IDocumentType of the document.

Remarks:

For an existing document this property is read-only.

Returns:

The value of Type.

Return type:

type (IDocumentType)

property values

Gets Values.

Description:

An IDatabaseValues object that can be used to read/write the document’s data values.

Remarks:

For an existing document using this property will result in an error, instead use the Document.values property directly.

Returns:

The value of Values.

Return type:

values (IDatabaseValues)

property was_created

Gets was_created.

Description:

Determines if the IDocument was successfully created.

Remarks:

After using the IDocumentCreator.perform method you can determine which IDocument’s were created successfully. Introduced in Impact 9.0.0.88.

Returns:

The value of was_created.

Return type:

was_created (bool)

add_relationship(document_latest_version, relationship, external_type, object_i_d)
Description:

Adds a document relationship.

Remarks:

See IDocumentRelationships.add for details of valid object_id values.

Parameters:
  • document_latest_version (bool) – Links the relationship to the latest document version when true, or the current document version when false.

  • relationship (ipDocumentRelationship) – The type of relationship to add.

  • external_type (str) – The external type of relationship for drExternal. It is recommended to use a format such as [domain]:[type] to identify external objects to avoid clashes with other applications. For example ‘webcnx:task’.

  • object_id (any) – The object that this relationship references.

get_thumbnail_file(page, width, height)
Description:

Gets a thumbnail image file for the document.

Remarks:

If the Page parameter falls outside the page range this method fails. Use the get_thumbnails_begin/get_thumbnails_end methods if you are generating more the one thumbnail image size for this document. See IDocument.get_thumbnail_file for details of how thumbnails are generated. This method works for both local files and existing documents.

Returns:

A full path to the image thumbnail file.

Parameters:
  • page (int) – The page number within the document the thumbnail should be generated for.

  • width (int) – The width in pixels of the thumbnail image required.

  • height (int) – The height in pixels of the thumbnail image required.

get_thumbnail_stream(page, width, height)
Description:

Gets a thumbnail image stream for the document.

Remarks:

If the Page parameter falls outside the page range this method fails. Use the get_thumbnails_begin/get_thumbnails_end methods if you are generating more the one thumbnail size for this document. See IDocument.get_thumbnail_file for details of how thumbnails are generated. This method works for both local files and existing documents.

Returns:

This method returns an IUnknown interface but the interface also supports the IStream interface.

Parameters:
  • page (int) – The page number within the document the thumbnail should be generated for.

  • width (int) – The width in pixels of the thumbnail image required.

  • height (int) – The height in pixels of the thumbnail image required.

get_thumbnails_begin(transparent_to_colour_r_g_b)
Description:

Begins the generation of multiple thumbnail images.

Remarks:

You must match each call of get_thumbnail_begin with a corresponding call to get_thumbnail_end.

Parameters:

transparent_to_colour_rgb (int) – The RGB background colour to replace any thumbnail transparency.

get_thumbnails_end()
Description:

Ends the generation of multiple thumbnail images.

Remarks:

You must match each call of get_thumbnail_end with a previous call to get_thumbnail_begin.

relationship(index)
Description:

Gets an IDocumentCreatorRelationship object with the specified index.

Remarks:

The document relationships are not created until the IDocumentCreator.perform method is called. Each of the document relationships added using this method will be created just for this document. See IDocumentRelationships.add for details of valid object_id values. To add common document relationships for all IDocumentCreatorDocument objects in the IDocumentCreator use the IDocumentCreator.add_relationship method instead.

Parameters:

index (any) – Specifies the index of the IDocumentCreatorRelationship object to get.

remove_relationship(index)
Description:

Removes a specific IDocumentCreatorRelationship.

Parameters:

index (any) – Specifies the index of the IDocumentCreatorRelationship object to remove.