-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinter.php
More file actions
42 lines (25 loc) · 1.18 KB
/
Copy pathprinter.php
File metadata and controls
42 lines (25 loc) · 1.18 KB
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
<?php
// Previously failed if casing didn't match CUPS exactly
$handle = printer_open("Epson-T20III"); // Now works regardless of case
// Error now shows available options instead of generic failure
$handle = printer_open("NonExistent");
// Warning: couldn't find printer [NonExistent]. Available printers: epson-t20iii, KELLER, PDFtest
$handle = printer_open();
printer_start_doc($handle, "PHP Test");
printer_start_page($handle);
$pen = printer_create_pen(PRINTER_PEN_SOLID, 2, "000000");
printer_select_pen($handle, $pen);
printer_draw_rectangle($handle, 10, 10, 1000, 175);
printer_delete_pen($pen);
$font = printer_create_font("Arial", 72, 48, PRINTER_FW_NORMAL, false, true, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, "Printing with PHP 4", 20, 50);
printer_delete_font($font);
$font = printer_create_font("Arial", 24, 12, PRINTER_FW_MEDIUM, false, false, false, 0);
printer_select_font($handle, $font);
printer_set_option($handle, PRINTER_TEXT_COLOR, "000000");
printer_draw_text($handle, "PHP is simply the coolest scripting language!", 20, 200);
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);