* The Ar-PHP library uses the default internal encoding, and can print * a lot of errors depending on the input, so be prepared to debug * the next four lines. * * Note that this output shows that numerals are converted to placeholder * characters, indicating that western numerals (123) have to be used instead. */ mb_internal_encoding("UTF-8"); $Arabic = new I18N_Arabic('Glyphs'); $textLtr = $Arabic->utf8Glyphs($textUtf8, $maxChars); $textLine = explode("\n", $textLtr); /* * Set up and use an image print buffer with a suitable font */ $buffer = new ImagePrintBuffer(); $buffer->setFont($fontPath); $buffer->setFontSize($fontSize); $profile = EposTepCapabilityProfile::getInstance(); $connector = new FilePrintConnector("php://output"); // = new WindowsPrintConnector("LPT2"); // Windows LPT2 was used in the bug tracker $printer = new Printer($connector, $profile); $printer->setPrintBuffer($buffer); $printer->setJustification(Printer::JUSTIFY_RIGHT); foreach ($textLine as $text) { // Print each line separately. We need to do this since Imagick thinks // text is left-to-right $printer->text($text . "\n"); } $printer->cut(); $printer->close();