I have integrated a Esri Map in my angular application. In the application there is a download button where user clicks on that download button the screenshot of an Esri Map should taken implicitly and that screenshot should download it as a pdf.
Could you please help me on this?
arcgis-js-api version 4.2.1 angular version 11.
.ts file
initializeMap(esriToken) {
const container = this.mapViewEl.nativeElement;
config.apiKey = esriToken;
const horizonData: any[] = this.esiriData || [];
//load the webMap
const webmap = new WebMap({
portalItem: {
id: this.webMapId
}
});
// load the feature layer
const layer = new FeatureLayer({
url: this.featureLayerUrl,
});
webmap.add(layer);
const view = new MapView({
container,
map: webmap,
});
let options = {
width: 2048,
height: 2048
};
view.takeScreenshot(options).then(function(screenshot) {
let imageElement = document.getElementById("screenshotImage");
imageElement.src = screenshot.dataUrl;
});
this.view = view;
return this.view.when();
}
.html file
<kendo-pdf-export #pdf paperSize="A4" margin="1cm" [scale]="scale">
<!-- Map Div -->
<div #mapViewNode></div>
<div class="float-right">
<div class="downloa-ico pr-1 float-left" (click)="pdf.saveAs('sample.pdf')"></div>
</div>
</kendo-pdf-export>