I have a Raspberry Pi 3 server and want to print PDF file using PHP code. I have setup CUPS, and tested printing from iPad, but what it does is takes it to the generated PDF for which the user would then need to click the apple share find print, select printer. It does print, but want the PHP page to call the printer directly as soon as they click submit.
I have this piece commented out because I have this enabled when I want PDF to show in browser and print from there.
// return $pdf->Output();
if ( $file == true ) {
$filename = preg_replace('/[^a-zA-Z0-9-_\.]/', '_', $name);
$fullpath = $this->savedirectory . strtolower($filename . '.pdf');
$pdf->Output($fullpath, 'F');
$pdf->Close();
$cmd = 'lp -P ' . $fullpath;
$cmdout = shell_exec($cmd);
return $fullpath;
}
</div>