Skip to content

Instantly share code, notes, and snippets.

@Pax125
Pax125 / direct_print.php
Created March 15, 2018 05:04 — forked from matteomattei/direct_print.php
PHP script that executes lpr program
<?php
function print_labels($files)
{
$cmd = '/usr/bin/lpr -PDYMO_LabelWriter_450_Turbo -o PageSize=w102h252.1 -o PageRegion=w102h252.1 -o landscape -o page-left=10 -o page-top=10 -o page-right=0 -o page-bottom=0 -o Resolution=300dpi -o cupsDarkness=Normal -o scaling=100 '.$files;
$output = system($cmd, $ret);
if($ret!=0 || $output!='')
{
return 'ERR ['.$ret.']: '.$output;
}