function printHTML($xml, $htmlOutput, $imageURL){
$htmlTemplate = file_get_contents('resources/print_template.html');
$replaceKeys = array();
$replaceKeys['IMAGE'] = $imageURL;
$canvas = $xml->getElementsByTagName('canvas')->item(0);
for($i = 0; $i < $canvas->childNodes->length; $i++) {
$child = $canvas->childNodes->item($i);
if($child->tagName == 'param') {
$pName = strtoupper($child->getAttribute('name'));
$pValue = $child->getAttribute('value');
$replaceKeys[$pName] = $pValue;
}
}
foreach($replaceKeys as $key=>$value) {
$htmlTemplate = str_replace('['.$key.']', $value, $htmlTemplate);
}
$output = fopen($htmlOutput, "w");
fprintf($output, "%s", $htmlTemplate);
fclose($output);
}
?>