Custom Print Tool for 3D SceneView in ArcGIS Javascript API 4.4

Custom Print Tool for SceneView in 4.4
DISCLAIMER: the resulting PDF is 2D.
Sample link:
JS Bin – Collaborative JavaScript Debugging
http://jsbin.com/cayojul/edit?js,output
Your browser will probably block the PDF by default since it opens in a new tab/window.
This is a print tool I built for a 3D app. It works by spinning up a transparent 2D map of the same area when the print button is clicked, then using that 2D map for the print task. When the modal is closed, the 2D map container is emptied so it’s not running behind the scenes unless printing is active.
The widget UI uses Materialize, and the print task calls the default ArcGIS Online export web map (Print) service.
Here’s the simple popup-blocker error handling I added:
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


