IDocumentThumbnailGenerator

class IDocumentThumbnailGenerator

Bases: ImpactCOMWrapperBase

Description:

Represents a document thumbnail generator.

Remarks:

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 extender

Gets Extender.

Description:

The document extender which implements this IDocumentThumbnailGenerator.

Returns:

The value of Extender.

Return type:

extender (IDocumentExtender)

property key

Gets Key.

Description:

A unique document thumbnail generator key.

Returns:

The value of Key.

Return type:

key (str)

begin(source_file, transparent_to_colour_r_g_b)
Description:

Begins the generation of multiple thumbnail images.

Remarks:

Using the Begin/Generate/End methods can efficiently generate multiple thumbnail images for the same source file. The source file only needs to be loaded once and used to generate multiple images. It is important to call the End method to clean up and close any open files.

Returns:

This function returns a Token that must be used in subsequent calls to Generate and End.

Parameters:
  • source_file (str) – The full path to the source file.

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

end(token)
Description:

Ends the generation of multiple thumbnail images.

Remarks:

The End method clean ups and close any open files used during the generation of thumbnail images.

Parameters:

token (int) – A token obtained from a call to Begin.

generate(token, destination_file_name, page, width, height)
Description:

Generates a thumbnail image.

Remarks:

The Generate method can be used to efficiently generate multiple thumbnail images for the same file. To use Generate you must first call the Begin method to receive a Token that can be passed to subsequent Generate calls. Once you have finished generating thumbnails you must call the End method. To generate a single thumbnail image use the generate_single method instead. If the source file format supports multi-paged files then the Page parameter is used to generate a thumbnail for a specific page, otherwise it is ignored. The destination_file_name must use a ‘jpg’ extension. The maximum allowed values for Width and Height is 2000 pixels.

Parameters:
  • token (int) – A token obtained from a call to Begin.

  • destination_file_name (str) – The full path to the destination thumbnail image to be generated.

  • page (int) – The page number to generate the thumbnail image for.

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

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

generate_single(source_file, destination_file_name, page, width, height)
Description:

Generates a single thumbnail image.

Remarks:

To generate multiple thumbnail images for the same file use the Begin/Generate/End methods instead. If the source file format supports multi-paged files then the Page parameter is used to generate a thumbnail for a specific page, otherwise it is ignored. The destination_file_name must use a ‘jpg’ extension. The maximum allowed values for Width and Height is 2000 pixels.

Parameters:
  • source_file (str) – The full path to the source file.

  • destination_file_name (str) – The full path to the destination thumbnail image to be generated.

  • page (int) – The page number to generate the thumbnail image for.

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

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

Examples