Fix Javascript and LPR shell command

This commit is contained in:
Alfred Egger 2019-06-24 23:53:07 +02:00
parent cdc94d2db7
commit 470d7c09ef
2 changed files with 3 additions and 3 deletions

View file

@ -76,7 +76,7 @@
} }
var url = OC.generateUrl('/apps/printer/printfile'), var url = OC.generateUrl('/apps/printer/printfile'),
data = {source: fileInfo.getFullPath(), orientation: orientation}, data = {sourcefile: fileInfo.getFullPath(), orientation: orientation},
_self = this; _self = this;
$.ajax({ $.ajax({
type: 'GET', type: 'GET',

View file

@ -29,7 +29,7 @@ class PrinterController extends Controller {
public function printfile($sourcefile, $orientation) { public function printfile($sourcefile, $orientation) {
if($orientation === "landscape") { if($orientation === "landscape") {
$filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile); $filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile);
exec('lpr ' . $filefullpath); exec('sudo lpr "' . $filefullpath . '"');
return new JSONResponse( return new JSONResponse(
array( array(
'response' => 'success', 'response' => 'success',
@ -40,7 +40,7 @@ class PrinterController extends Controller {
if($orientation === "portrait"){ if($orientation === "portrait"){
$filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile); $filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile);
exec('lpr -o orientation-requested=4 ' . $filefullpath); exec('sudo lpr -o orientation-requested=4 "' . $filefullpath . '"');
return new JSONResponse( return new JSONResponse(
array( array(
'response' => 'success', 'response' => 'success',