selectPrintMode() 공개 메소드

Several MODE_* constants can be OR'd together passed to this function's $mode argument. The valid modes are: - Printer::MODE_FONT_A - Printer::MODE_FONT_B - Printer::MODE_EMPHASIZED - Printer::MODE_DOUBLE_HEIGHT - Printer::MODE_DOUBLE_WIDTH - Printer::MODE_UNDERLINE
public selectPrintMode ( integer $mode = Printer::MODE_FONT_A )
$mode integer The mode to use. Default is Printer::MODE_FONT_A, with no special formatting. This has a similar effect to running initialize().
예제 #1
2
function title(Printer $printer, $text)
{
    $printer->selectPrintMode(Printer::MODE_EMPHASIZED);
    $printer->text("\n" . $text);
    $printer->selectPrintMode();
    // Reset
}
예제 #2
1
function title(Printer $printer, $str)
{
    $printer->selectPrintMode(Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_DOUBLE_WIDTH);
    $printer->text($str);
    $printer->selectPrintMode();
}
예제 #3
0
파일: receipt.php 프로젝트: jslemmer/cafe
/* Open file to write the ID */
$file = fopen("receipts/id.txt", "r") or die("asdsd");
$id = fgets($file);
fclose($file);
// Select customer and order info
$sql_orders = "select Order_id,o.cus_id,firstname as fname,lastname as lname,Date,Time,payed from orders as o LEFT JOIN customer_info as c ON o.cus_id = c.cus_id WHERE Order_id = {$id}";
$result = $mysql->query($sql_orders);
$row_order = $mysql->fetch($result);
if (empty($row_order['lname']) && empty($row_order['fname'])) {
    $cusname = 'Unknown';
} else {
    $cusname = $row_order['fname'] . " " . $row_order['lname'];
}
/* Print customer and order ID */
$printer->setJustification(Printer::JUSTIFY_CENTER);
$printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH);
$printer->text("{$cusname}\n");
$printer->selectPrintMode();
$printer->text("Order# {$id}\n");
$printer->feed(2);
// Select ordered items
$sql_item_detail = "SELECT Item_id,F.order_id,cus.lastname as lname,Cs.cata_name as Food_name,Cp.Cata_name,Quantity,Cs.price as Single_Price,(Cs.price*quantity)as Total_Price,F.food_id from order_food as F JOIN orders as O on F.order_id = O.order_id JOIN food_catalogue as Cs ON F.food_id = Cs.food_id JOIN food_catalogue as Cp ON Cp.food_id = Cs.catalog_id LEFT JOIN customer_info as cus ON cus.cus_id = O.cus_id WHERE F.order_id= {$id}";
$result_item_detail = $mysql->query($sql_item_detail);
$sum = '';
while ($row_item_detail = $mysql->fetch($result_item_detail)) {
    $food_name = $row_item_detail['Food_name'];
    $qualtity = $row_item_detail['Quantity'];
    $total = $row_item_detail['Total_Price'];
    $sum = $sum + $total;
    $printer->text("{$food_name} ({$qualtity}) - {$total} RMB\n");
}
예제 #4
0
 *
 * The DefaultCapabilityProfile works for Espson-branded printers. For other models, you
 * must use/create a PrinterCapabilityProfile for your printer containing a list of code
 * page numbers for your printer- otherwise you will get mojibake.
 *
 * If you do not intend to use non-English characters, then use SimpleCapabilityProfile,
 * which has only the default encoding, effectively disabling code page changes.
 */
include dirname(__FILE__) . '/resources/character-encoding-test-strings.inc';
try {
    // Enter connector and capability profile (to match your printer)
    $connector = new FilePrintConnector("php://stdout");
    $profile = DefaultCapabilityProfile::getInstance();
    /* Print a series of receipts containing i18n example strings */
    $printer = new Printer($connector, $profile);
    $printer->selectPrintMode(Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_EMPHASIZED | Printer::MODE_DOUBLE_WIDTH);
    $printer->text("Implemented languages\n");
    $printer->selectPrintMode();
    foreach ($inputsOk as $label => $str) {
        $printer->setEmphasis(true);
        $printer->text($label . ":\n");
        $printer->setEmphasis(false);
        $printer->text($str);
    }
    $printer->feed();
    $printer->selectPrintMode(Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_EMPHASIZED | Printer::MODE_DOUBLE_WIDTH);
    $printer->text("Works in progress\n");
    $printer->selectPrintMode();
    foreach ($inputsNotOk as $label => $str) {
        $printer->setEmphasis(true);
        $printer->text($label . ":\n");
예제 #5
0
파일: demo.php 프로젝트: mike42/escpos-php
$printer->text("DEF");
$printer->feedReverse(3);
$printer->text("GHI");
$printer->feed();
$printer->cut();
/* Font modes */
$modes = array(Printer::MODE_FONT_B, Printer::MODE_EMPHASIZED, Printer::MODE_DOUBLE_HEIGHT, Printer::MODE_DOUBLE_WIDTH, Printer::MODE_UNDERLINE);
for ($i = 0; $i < pow(2, count($modes)); $i++) {
    $bits = str_pad(decbin($i), count($modes), "0", STR_PAD_LEFT);
    $mode = 0;
    for ($j = 0; $j < strlen($bits); $j++) {
        if (substr($bits, $j, 1) == "1") {
            $mode |= $modes[$j];
        }
    }
    $printer->selectPrintMode($mode);
    $printer->text("ABCDEFGHIJabcdefghijk\n");
}
$printer->selectPrintMode();
// Reset
$printer->cut();
/* Underline */
for ($i = 0; $i < 3; $i++) {
    $printer->setUnderline($i);
    $printer->text("The quick brown fox jumps over the lazy dog\n");
}
$printer->setUnderline(0);
// Reset
$printer->cut();
/* Cuts */
$printer->text("Partial cut\n(not available on all printers)\n");