generateImages (width:any, height:any) {
console.log(width)
console.log(height)
// sanitize input
width = parseInt(width);
height = parseInt(height);
if (isNaN(width)) width = 100;
if (isNaN(height)) height = 100;
// Give a minimum size of 50x50
width = Math.max(width, 50);
height = Math.max(height, 50);
var imgDiv = document.getElementById('myImages');
console.log(imgDiv)
imgDiv.innerHTML = ''; // clear out the old images, if any
var db = this.myDiagram.documentBounds.copy();
var boundswidth = db.width;
var boundsheight = db.height;
var imgWidth = width;
var imgHeight = height;
var p = db.position.copy();
//making images
for (var i = 0; i< boundsheight; i += imgHeight) {
var img:any
for (var j = 0; j < boundswidth; j += imgWidth) {
img= this.myDiagram.makeImage({
scale: 1,
type: "image/jpeg",
background: "AntiqueWhite",
position: new go.Point(p.x + j, p.y + i),
size: new go.Size(imgWidth, imgHeight)
});
// Append the new HTMLImageElement to the #myImages div
img.className = 'images';
imgDiv.appendChild(img);
imgDiv.appendChild(document.createElement('br'));
}
this.saveAsFile(img);
}
}
destroyClickedElement(event:any){
document.body.removeChild(event.target);
}
saveAsFile(val:any)
{
var pdf_image = val
var textToSaveAsBlob = new Blob([pdf_image], {type:“image/jpeg”});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
// var fileNameToSaveAs = document.getElementById(“inputFileNameToSaveAs”).value;
var downloadLink = document.createElement("a");
downloadLink.download = "richard";
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.onclick = this.destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}