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 = CapabilityProfile::load("TEP-200M"); $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();