Class ExportPngPartial

class ooodev.draw.shapes.partial.export_png_partial.ExportPngPartial(component, events=None, lo_inst=None)[source]

Partial Class for Shapes that implements png export.

Parameters:
  • component (XShape) –

  • events (Events | None) –

  • lo_inst (LoInst | None) –

__init__(component, events=None, lo_inst=None)[source]

Constructor.

Parameters:
  • component (XShape) – Shape component.

  • events (Events, optional) – Events instance.

  • lo_inst (LoInst, optional) – Lo Instance. Use when creating multiple documents. Defaults to None.

export_shape_png(fnm, resolution=96)[source]

Exports shape as png image.

Parameters:
  • fnm (PathOrStr, optional) – Image file name.

  • resolution (int, optional) – Resolution in dpi. Defaults to 96.

Events:
Return type:

None

Note

On exporting event is Class CancelEventArgsExport. On exported event is Class EventArgsExport. Args event_data is a ExportPngT dictionary.

If fnm is not specified, the image file name is created based on the document name and page number and written to the same folder as the document.

When page is exported as png, such as an impress slide, any images on the will not be exported if filter translucent=True. For this reason, the default value for translucent is False.

subscribe_event_shape_png_exported(callback)[source]

Add an event listener to current instance that is triggered on export complete.

Parameters:

callback (Callable[[Any, EventArgsExport[ExportPngT]], None]) – Callback of the event listener.

Return type:

None

subscribe_event_shape_png_exporting(callback)[source]

Add an event listener to current instance that is triggered on exporting.

Parameters:

callback (Callable[[Any, CancelEventArgsExport[ExportPngT]], None]) – Callback of the event listener.

Return type:

None

unsubscribe_event_shape_png_exported(callback)[source]

Remove an event listener from current instance.

Parameters:

callback (Callable[[Any, EventArgsExport[ExportPngT]], None]) – Callback of the event listener.

Return type:

None

unsubscribe_event_shape_png_exporting(callback)[source]

Remove an event listener from current instance.

Parameters:

callback (Callable[[Any, CancelEventArgsExport[ExportPngT]], None]) – Callback of the event listener.

Return type:

None