Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greek character printing #50

Closed
stadem opened this issue Aug 17, 2015 · 9 comments
Closed

Greek character printing #50

stadem opened this issue Aug 17, 2015 · 9 comments

Comments

@stadem
Copy link

stadem commented Aug 17, 2015

Hello, I am using P-822D Thermal printer and everything is working great except from printing Greek characters (the are displayed as chinese)

Is there any settings i can do?

Thank you

@mike42
Copy link
Owner

mike42 commented Aug 18, 2015

Hi, I think you're the first person to try getting this printer working (definitely the first to try it in Greek anyway).

We most likely need to assemble a CapabilityProfile including the correct way to access a Greek code page on your printer. The driver is probably using the DefaultCapabilityProfile (for Epson-branded printers) at the moment, which would explain the strange output.

Do you have any documentation available which contains a list of supported code pages for the P-822D? A quick Google search doesn't turn up much.

@stadem
Copy link
Author

stadem commented Aug 18, 2015

Hello, thank you for your answer.

The code page of P-822D is :
p-822d

@mike42
Copy link
Owner

mike42 commented Aug 19, 2015

Perfect,

I'll post the CapabilityProfile and a test receipt when ready. Hopefully we can get this model of printer working.

@stadem
Copy link
Author

stadem commented Aug 20, 2015

Great, thank you.

@mike42 mike42 self-assigned this Aug 20, 2015
mike42 added a commit that referenced this issue Aug 20, 2015
@mike42
Copy link
Owner

mike42 commented Aug 20, 2015

Ok, I've added a profile matching this list of code pages. Can you pull and let me know what the output of the example example/specific/50-P-822D-greek.php is?

(If it doesn't render correctly yet, then I'll get you to run some code snippets for debugging)

<?php
/* Example of Greek text on the P-822D */
require_once(dirname(__FILE__) . "/../../Escpos.php");

// Setup the printer
$connector = new FilePrintConnector("php://stdout");
$profile = P822DCapabilityProfile::getInstance();
$printer = new Escpos($connector, $profile);

// Print a Greek pangram
$text = "Ξεσκεπάζω την ψυχοφθόρα βδελυγμία";
$printer -> text($text . "\n");
$printer -> cut();

// Close the connection
$printer -> close();

@stadem
Copy link
Author

stadem commented Aug 21, 2015

I think that the problem is on device code page.
Only capital letters works fine.

After some tests...
001

@mike42
Copy link
Owner

mike42 commented Aug 23, 2015

Hmm. It's not at all obvious to me why Chinese text appears when your printer tries to work with these code pages.

From what I can find about related models on Google, DIP switches are something we may need to tweak here.

Two things-

  • What platform & interface are you printing from?
  • Can you flip the SW-4 DIP switch ('two character code pages') and re-print the tables of Greek code pages?

@mike42
Copy link
Owner

mike42 commented Apr 23, 2016

I'm closing this issue off, as it's likely to relate to the reporter's printer config. You may need to contact the vendor for advice about how to disable this Chinese text output.

For others, the general way to print most European languages with this driver is to simply send in UTF-8-

<?php
require __DIR__ . '/../../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\CapabilityProfiles\DefaultCapabilityProfile;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;

// Setup the printer
$connector = new FilePrintConnector("php://stdout");
$profile = DefaultCapabilityProfile::getInstance();
$printer = new Printer($connector, $profile);

// Print a Greek pangram
$text = "Ξεσκεπάζω την ψυχοφθόρα βδελυγμία";
$printer -> text($text . "\n");
$printer -> cut();

// Close the connection
$printer -> close();

Result (TM-T20II):

greek-text-snippet

In the case of the P-822D, DefaultCapabilityProfile is swapped with P822DCapabilityProfile.

See also #62

@zacharias-pavlatos
Copy link

Worked for me with NetworkPrintConnector

$text = iconv('UTF-8', 'ISO-8859-7', "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΧΩ");
$printer -> textRaw($text ."\n");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants