1.2.0 • Published 2 years ago

@polar/plugin-export v1.2.0

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
2 years 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
showJpgbooleanTools offers current map view as JPG.
showPdfbooleanTools offers current map view as PDF.
showPngbooleanTools offers current map view as PNG.
downloadbooleanWhether 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.

Store

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

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 immediately show a Png screenshot in an image tag. The value of the screenshot variable is a base64-encoded string.

const someImgTag = // ... however you retrieve your tag
  map.subscribe('plugin/export/exportedMap', (screenshot) =>
    someImgTag.setAttribute('src', screenshot)
  )
1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago