2
0
forked from Wavyzz/dolibarr
Files
dolibarr-fork/htdocs/includes/mike42/escpos-php/example/specific/44-pound-symbol-star-tsp650.php
Laurent Destailleur 9f20779136 Revert "Update escpos-php"
This reverts commit 2f42a226d0.
2016-05-18 13:18:55 +02:00

32 lines
1.1 KiB
PHP

<?php
/* Example of printing the GBP pound symbol on a STAR TSP650
*
* In this example, it's shown how to check that your PHP files are actually being
* saved in unicode. Sections B) and C) are identical in UTF-8, but different
* if you are saving to a retro format like Windows-1252.
*/
// Adjust these to your environment
require_once(dirname(__FILE__) . "/../../Escpos.php");
$connector = new FilePrintConnector("php://stdout");
// Start printer
$profile = SimpleCapabilityProfile::getInstance();
$printer = new Escpos($connector, $profile);
// A) Raw pound symbol
// This is the most likely thing to work, and bypasses all the fancy stuff.
$printer -> textRaw("\x9C"); // based on position in CP437
$printer -> text(" 1.95\n");
// B) Manually encoded UTF8 pound symbol. Tests that the driver correctly
// encodes this as CP437.
$printer -> text(base64_decode("wqM=") . " 2.95\n");
// C) Pasted in file. Tests that your files are being saved as UTF-8, which
// escpos-php is able to convert automatically to a mix of code pages.
$printer -> text("£ 3.95\n");
$printer -> cut();
$printer -> close();