-
Notifications
You must be signed in to change notification settings - Fork 2
/
pdfprint.php
43 lines (32 loc) · 1.32 KB
/
pdfprint.php
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
32
33
34
35
36
37
38
39
40
41
42
43
<?php
error_reporting( -1 );
ini_set( 'display_errors', 1 );
/* require_once("PrintIPP.php");
$ipp = new PrintIPP();
$ipp->setHost("localhost");
$ipp->setPrinterURI("/printers/PDF");
$ipp->setMimeMediaType("text/plain");
// $ipp->setData("http://127.0.0.1/airscan.php?image=Scan20190112165555RotateFlip.jpg");
// $ipp->setData("./scans/Scan20190112165555RotateFlip.jpg"); // Path to file.
$ipp->setData("test.txt");
$ipp->printJob();
*/
//specify the pdf you'd like to print
// $file = '/var/www/data/myfile.pdf';
//Change PrinterName to the name of the printer you set up in CUPS
//$cmd = "lpr -PDF";
//append any files you'd like to print to the end of the command
// $cmd .= $file;
//Runs "lpr -PPrinterName /var/www/data/myfile.pdf" and brings back any output to the console.
// $response = shell_exec($cmd);
$filename="http:\/\/127.0.0.1\/airscan.php";
function topdf($filename, $options = "") {
# Tell HTMLDOC not to run in CGI mode...
putenv("HTMLDOC_NOCGI=1");
# Write the content type to the client...
header("Content-Type: application/pdf");
flush();
# Run HTMLDOC to provide the PDF file to the user...
passthru("htmldoc -t pdf --quiet --jpeg --webpage $options " . escapeshellarg($filename));
}
?>