-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprint.php
More file actions
31 lines (23 loc) · 769 Bytes
/
print.php
File metadata and controls
31 lines (23 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
$_GET = array();
foreach($argv as $key => $pair) {
if ($key == 0) { //skip first element which is script name (test.php)
continue;
}
list($key, $value) = explode(":", $pair);
$_GET[$key] = $value;
print $key;
print $value;
}
$text_file = "/home/pi/quest_smith/story_text/".$_GET["story_follow_up"];
$myfile = fopen($text_file.".txt", "r") or die("Unable to open file!");
$section = fread($myfile,filesize($text_file.".txt"));
fclose($myfile);
$connector = new FilePrintConnector("/dev/usb/lp0");
$printer = new Printer($connector);
$printer -> text($section);
$printer -> cut();
$printer -> close();