Automatically Run a HTML Script

Certified Associate Developer

I'm not sure if this is possible, but I'm trying to run a HTML script that creates a chart and then exports it as an image in a process model. I'd like to then use that image (and other data) to create a PDF report using the Fill PDF smart service. However, currently for the image to export the HTML file has to be downloaded and opened. Is there a way to have it run automatically in the process model?

I also tried the PDF from HTML smart service but that doesn't seem to support charts.

Here is the HTML code I'm using to test this process. I'm pretty new to working with HTML so if anyone has suggestions on that front, I'm open to that too.

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
window.onload = function () {
	var chart = new CanvasJS.Chart("chartContainer", {
		theme: "light2",
		title:{
			text: "Export Chart using exportChart method"              
		},
		data: [              
		{
			type: "column",
			dataPoints: [
				{ label: "apple",  y: 10  },
				{ label: "orange", y: 15  },
				{ label: "banana", y: 25  },
				{ label: "mango",  y: 30  },
				{ label: "grape",  y: 28  }
			]
		}
		]
	});
  
	chart.render();
 	chart.exportChart({format: "jpg", fileName: "Chart Export Test"});  
}
</script>
  <script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</head>
<body>
<div id="chartContainer" style="height: 275px; width: 100%;"></div>
</body>
</html>

Thanks!

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data