Ejemplo n.º 1
0
     function AutoPrintToPrinter($server, $printer, $dialog = false)
     {
         //Print on a shared printer (requires at least Acrobat 6)
         $script = "var pp = getPrintParams();";
         if ($dialog) {
             $script .= "pp.interactive = pp.constants.interactionLevel.full;";
         } else {
             $script .= "pp.interactive = pp.constants.interactionLevel.automatic;";
         }
         $script .= "pp.printerName = '\\\\\\\\" . $server . "\\\\" . $printer . "';";
         $script .= "print(pp);";
         $this->IncludeJS($script);
     }
 }
 $pdf = new PDF_AutoPrint('P', 'mm', 'A4');
 $pdf->AliasNbPages();
 $pdf->SetTopMargin(10);
 $pdf->SetLeftMargin(10);
 $pdf->SetRightMargin(10);
 $pdf->AddPage();
 $pdf->SetWidths(array(20, 20, 20, 20, 110));
 $pdf->SetAligns(array('C', 'R', 'R', 'R', 'L'));
 srand(microtime() * 1000000);
 $pdf->Table();
 $filename = "Laporan Stok " . $GLOBALS['ItemName'] . " " . $GLOBALS['date'] . ".pdf";
 //$pdf->AutoPrint(true);
 if ($_GET['PrintType'] == "1") {
     $pdf->Output($filename, "D");
 } else {
     $pdf->AutoPrint(true);
     $pdf->Output($filename, "I");