1.2.2 • Published 9 months ago

@polar/plugin-export v1.2.2

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
9 months ago

Export

Scope

The Export plugin offers users to download the currently visible map canvas in a variety of file formats and by a variety of methods.

Configuration

export

fieldNametypedescription
downloadboolean?Whether file is offered for download. By default, no download will happen, and the using service is supposed to register whether a "screenshot" has been taken and react accordingly.
showJpgboolean?Tools offers current map view as JPG. Defaults to true.
showPdfboolean?Tools offers current map view as PDF. Defaults to true.
showPngboolean?Tools offers current map view as PNG. Defaults to true.

Example Configuration:

export: {
  download: true,
  showJpg: false,
  showPdf: false,
  showPng: true,
}

To remove user control, add displayComponent: false to the configuration and use the following interactions.

For details on the displayComponent attribute, refer to the Global Plugin Parameters section of @polar/core.

Store

Actions

To programmatically trigger a "screenshot", use this action.

// type is 'Png', 'Jpg', or 'Pdf'
map.$store.dispatch('plugin/export/exportAs', type)

State

This shows how a callback can be used to show the exported data in a suitable html element. The value of the screenshot variable is a base64-encoded string.

const someElement = // ... however you retrieve your html element
  map.subscribe('plugin/export/exportedMap', (screenshot) =>
    someElement.setAttribute('src', screenshot)
  )
1.2.2

9 months ago

1.2.1

11 months ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago