Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. function PrintIO_UDF($vaPrint){
  2. $cType = aCfg("msJavaPrint");
  3. $cTypeOS = GetSetting("cSession_optOS") ;
  4. if($cType == "Y"){
  5. PrintIO_UDF2($vaPrint) ;
  6. }else{
  7. PrintIO($vaPrint,true,0,'','/dev/lp0') ;
  8. }
  9. }
  10.  
  11. function PrintIO_UDF2($vaPrint,$nPortID=1){
  12. global $lNoJS;
  13. static $nCount = 0 ;
  14. $nCount ++ ;
  15. if($nCount > 5) $nCount = 5 ;
  16. $cFrameID = "IFRAMEPRINT_" . $nCount ;
  17. $cP = "" ;
  18. $cP = CHR(15) ; //RESET PRINTER
  19. $vaPrint[] = CHR(12) ;
  20. foreach($vaPrint as $key=>$value){
  21. //$cP .= $value . "\n" ;
  22. $cP .= CHR(27) . CHR(69) . $value . "\n" .CHR(27) . CHR(70);
  23. }
  24. $cTmpFile = GetTmpFile() . ".html" ;
  25. $cHTML = "<html><body onload='document.frmPrint.submit();'><form name='frmPrint' action='http://127.0.0.1:2700/print' method='post'>" ;
  26. $cHTML .= "<input type='hidden' name='nPort' value='$nPortID' />" ;
  27. $cHTML .= "<textarea name='cPrint'>$cP</textarea>" ;
  28. $cHTML .= "</form></body></html>" ;
  29. $fp = fopen($cTmpFile, "w");
  30. fwrite($fp, $cHTML);
  31. fclose($fp);
  32. if($lNoJS){
  33. echo('
  34. var o = a.getById("' . $cFrameID . '") ;
  35. if(o == null){
  36. o = a.addObj("iframe") ;
  37. o.id = "' . $cFrameID . '" ;
  38. }
  39. o.width = 0 ;
  40. o.height = 0 ;
  41. o.src = "' . $cTmpFile . '" ;
  42. ') ;
  43. }else{
  44. echo('
  45. <iframe id="' . $cFrameID . '" width=0 height=0 src="'. $cTmpFile.'"></iframe>
  46. ');
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement