<?php
$mychn='"'.$_GET['chn'].'"';
$x1='"'."128M".'"';
$x2='"'."ROMAN.TTF".'"';
$myfile = fopen("krm.prn", "w") or die("Unable to open file!");
$txt = stripslashes("<xpml><page quantity='0' pitch='36.6 mm'></xpml>SIZE 57.5 mm, 36.6 mm)");
$txt .="\r\n";
$txt .=stripslashes("BLINE 2.9 mm, 3 mm");
$txt .="\r\n";
$txt .=stripslashes("SPEED 2");
$txt .="\r\n";
$txt .=stripslashes("DENSITY 14");
$txt .="\r\n";
$txt .=stripslashes("SET RIBBON ON");
$txt .="\r\n";
$txt .=stripslashes("DIRECTION 0,0");
$txt .="\r\n";
$txt .=stripslashes("REFERENCE 0,0");
$txt .="\r\n";
$txt .=stripslashes("OFFSET 1 mm");
$txt .="\r\n";
$txt .=stripslashes("SHIFT 35");
$txt .="\r\n";
$txt .=stripslashes("SET PEEL OFF");
$txt .="\r\n";
$txt .=stripslashes("SET CUTTER OFF");
$txt .="\r\n";
$txt .=stripslashes("SET PARTIAL_CUTTER OFF");
$txt .="\r\n";
$txt .=stripslashes("<xpml></page></xpml><xpml><page quantity='1' pitch='36.6 mm'></xpml>SET TEAR ON");
$txt .="\r\n";
$txt .=stripslashes("CLS");
$txt .="\r\n";
$txt .=stripslashes("BARCODE 624,420,$x1,73,0,180,2,4,$mychn");
$txt .="\r\n";
$txt .=stripslashes("CODEPAGE 1252");
$txt .="\r\n";
$txt .=stripslashes("TEXT 573,343,$x2,180,1,8,$mychn");
$txt .="\r\n";
$txt .=stripslashes("BARCODE 298,420,$x1,73,0,180,2,4,$mychn");
$txt .="\r\n";
$txt .=stripslashes("TEXT 247,343,$x2,180,1,8,$mychn");
$txt .="\r\n";
$txt .=stripslashes("PRINT 1,1");
$txt .="\r\n";
$txt .=stripslashes("<xpml></page></xpml><xpml><end/></xpml>");
fwrite($myfile, $txt);
fclose($myfile);

$file_url = 'https://novaivf.in/ews_kormangala/ivflab_frzing/krm.prn';
header('Content-Type: application/force-download');
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\"" . basename("krm.prn") . "\"");
readfile($file_url);
exit;
?>