openstreetmap-ng icon indicating copy to clipboard operation
openstreetmap-ng copied to clipboard

Export sidebar: support PDF and SVG types

Open starsep opened this issue 8 months ago • 1 comments

I noticed that export to PDF and SVG does not work. On Firefox it exports to PNG. Short-term I would suggest to hide those options and add TODOs in the code.

Canvas.toBlob() api is used with mimetype: https://github.com/Zaczero/openstreetmap-ng/blob/8c6aa73486d50f2248a1c8b31b98c759465ad751/app/static/js/leaflet/_image-export.js#L174 On https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob I don't see any mentioned support of PDF/SVG. I think this feature makes mostly sense for raster graphics considering that raster tiles are joined.

OSM offloads hardwork to https://render.openstreetmap.org/. PDF is not just embedded png there: text is selectable for example.

Related TODO: https://github.com/Zaczero/openstreetmap-ng/blob/4ae2d74fe36bf077a18049297d21b84ff032d632/app/static/js/leaflet/_sidebar-share.js#L262

PS Perhaps this issue can be splitted to two: PDF/SVG if implementation will be different.

starsep avatar Jun 14 '24 21:06 starsep