alindley

Sample Custom Print Tool for Sceneview in 4.4

Blog Post created by alindley on Sep 22, 2017

Custom Print Widget for Sceneview in 4.4

**DISCLAIMER**the resulting pdf is in 2D.**

 

Here's a link to my sample:

JS Bin - Collaborative JavaScript Debugging 

*your browser will probably block the pdf by default, as it appears in a new tab or window

 

This is a print tool I made for a 3D app. It works by spinning up a transparent 2D map of the same area when the print button is clicked, and then uses that 2D map for the print task. When the tool is closed, the 2D map container is emptied, so it is not running behind the scenes unless the print widget form is open. The tool was made using materialize, and the print task uses the default ArcGIS Online export web map task url.

 

I also implemented some simple error handling for the case when the browser's popup blocker blocks the requested pdf like this:

function printResult(response) {
   var url = response.url;
   var newWindow = window.open(url);
   if (!newWindow) {
      $("#enablePopupModal").show();
   }
}

 

Hope this helps anyone trying to print in their 3D app!

Cheers

Outcomes