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

Add printer to databse Xprinter XP-58 #36

Open
brankotasevski opened this issue Mar 5, 2018 · 11 comments
Open

Add printer to databse Xprinter XP-58 #36

brankotasevski opened this issue Mar 5, 2018 · 11 comments

Comments

@brankotasevski
Copy link

Hi i have problem with Cyrillic on my XPRINTER XP-58 pos printer but my printer is not on database and i tray to add this code to capabilities.json but again not working how to add this printer to database ?
"Xprinter": {
"codePages": {
"0": "PC437",
"1": "Katakana",
"2": "PC580",
"3": "CP860",
"4": "CP863",
"5": "CP865",
"6": "West Europe",
"7": "Greek",
"8": "Hebrew",
"9": "East Europe",
"10": "Iran",
"16": "WCP1252",
"17": "PC866",
"18": "PC852",
"19": "PC858",
"20": "IranII",
"21": "Latvia",
"22": "Arabic",
"23": "PT1511251",
"24": "PC747",
"25": "WPC1257",
"27": "Vietnam",
"28": "PC864",
"29": "PC1001",
"30": "Uigru",
"31": "Hebrew",
"32": "WPC1255",
"255": "Thai"
},
"colors": {
"0": "black"
},
"features": {
"barcodeB": false,
"bitImageColumn": false,
"bitImageRaster": true,
"graphics": false,
"highDensity": true,
"pdf417Code": false,
"pulseBel": false,
"pulseStandard": true,
"qrCode": false,
"starCommands": false
},
"fonts": {
"0": {
"columns": 42,
"name": "Font A"
},
"1": {
"columns": 56,
"name": "Font B"
}
},
"media": {
"width": {
"mm": "Unknown",
"pixels": "Unknown"
}
},
"name": "XP-58",
"notes": "POS-XP58 thermal printer series, also marketed under various other names.\n",
"vendor": "Xprinter"
}

@mike42
Copy link
Collaborator

mike42 commented Mar 6, 2018

Start by copying an existing profile to data/profile/XP-58.yml (a very similar profile to copy is data/profile/POS-5890.yml), edit it as needed, and send through a pull request with the new file to get it added. For bonus points, identify any public vendor documentation that you used, so that the profile can be checked for accuracy.

You can only select from encodings that are in the database, which are stored in data/encodings.yml, anything else should be labeled "Unknown" with the name in comments.

To test your profile, you need to run some python (from our .travis.yml build script) to re-build dist/capabilities.json:

pip install pyyaml pyaml
python scripts/collate.py

You can copy that over the top of the capabilties.json in escpos-php.

See also How to get your printer included in the database.

@brankotasevski
Copy link
Author

brankotasevski commented Mar 6, 2018

i create a new profile to data/profile/XP-58.yml and this is data of profile

---
XP58:
  name: XP58 Series
  vendor: Xprinter
  inherits: simple
  fonts:
    0:
      name: Font A
      columns: 32
    1:
      name: Font B
      columns: 42
  media:
    width:
      mm: 57.5
      pixels: 384
  notes: >
     XP-58 thermal printer series, also marketed under various other names.
  codePages:
    0: PC437
    1: Katakana
    2: PC580
    3: CP860
    4: CP863
    5: CP865
    # West Europe
    6: Unknown
    # Greek
    7: Unknown
    # Hebrew
    8: Unknown
    # East Europe
    9: Unknown
    # Iran
    10: Unknown
    16: WCP1252
    17: PC866
    18: PC852
    19: PC858
    # Iran II
    20: Unknown
    # Latvian
    21: Unknown
    # Arabic
    22: Unknown
    # PT151, 1251
    23: PT1511251
    24: PC747
    25: WPC1257
    27: Vietnam
    28: PC864
    29: PC1001
    30: Uigru
    31: Unknown
    32: WPC1255
    255: Thai
...

But i have same problem if is possible i send my data (XP-58.yml) profile, (capabilities.json) to you to sold this problem for another users on this printer?

@mike42
Copy link
Collaborator

mike42 commented Mar 6, 2018

You are the first XP-58 user, but other users on the POS-5890 (similar printers) can access Cyrillic already. Many of the code pages you list are not listed in encodings.yml, so you would get an error if you try to re-build the capabilities.json at the moment. Your profile needs to say "Unknown" for a code page unless we know what it contains, or you will get garbage output :)

Is there a programming guide or test page you are using as source data for this list so that I can check it's correct? Should save us some effort if we can get it right the first time.

@brankotasevski
Copy link
Author

hello I tried with Russian keyboard support and print out all the letters with this code
$printer -> text(iconv("UTF-8","GBK//IGNORE", "Ф И М П В Ъ У Я Н Ш О Л Д Й Ь Т Ц Щ З К Ы Е Э Г А Р С Ж Ч Х\n") . "\n");

The problem I have is in some specific Macedonian letters as they are:
Ѓ Ѕ Ј Љ Њ Ќ Џ
I tried with Macedonian keyboard support and print out all the letters with this code
$printer -> text(iconv("UTF-8","GBK//IGNORE", "А Б В Г Д Ѓ Е Ж З Ѕ И Ј К Л Љ М Н Њ О П Р С Т Ќ У Ф Х Ц Ч Џ Ш\n") . "\n");
and i add this code
"CP3012": {
"data": [
"\u0410\u0411\u0412\u0413\u0414\u0403\u0415\u0416\u0417\u0405\u0418\u0408\u041a\u041b\u0409\u041c\u041d\u040A\u041e\u041f",
"\u0420\u0421\u0422\u0422\u040C\u0424\u0425\u0426\u0427\u040F\u0428"
],
"name": "CP3012 Cyrillic"
},
on encoding.yml but still print them without the other few letters I listed, how to add these letters to the printer's databases

img_20180313_125448

@mike42
Copy link
Collaborator

mike42 commented Mar 14, 2018

A printer's documentation or test page will list code page names with numbers (0-255). This is specific to every printer.

0        CP437
25      SUPER-ENCODING

The profile for this printer would start like this- edit the data/ files, not the JSON dist/ files.

codePages:
  10: Unknown
  25: Unknown

So you can't start by typing, you have to start by printing a code page and seeing what's in it. If I was interested in the contents of code page #25 (0x19 in hex), I might do this (attached code-table.bin to help you dump the tables:
code-table.zip).

echo -ne '\xb1@\xb1t\x19' > code-page-25.bin
cat code-page-25.bin code-table.bin > /dev/usb/lp0

You then get a page, which you need to match up to an existing iconv encoding, or type out and give it a name.

In my case, I recognise that the code page CP932 (check the database!) is a subset of this, so it's safe to list.

codePages:
  10: Unknown
  25: CP932

If it wasn't listed, I would define a new code page, and type out exactly 128 glyphs, encoded as UTF8, so that the driver can encode these.

When you're done, run the python to re-build capabilies.json, copy it over the version in escpos-php, and try printing!

(Disregard what you are doing so far and focus on associating a number with a picture of the output, CP3012 is not listed in the profile you made, and $printer -> text(iconv("UTF-8","GBK//IGNORE", "...") . "\n"); is going through multiple layers of encoding based on things that aren't in your snippet, so you can't draw any useful conclusions from the output!)

@andrewshadura
Copy link
Contributor

@stefpap
Copy link

stefpap commented May 21, 2020

Hello, I also have an XPRINTER XP-58IIH pos printer and I am facing an issue when im running the vendor\mike42\escpos-php\example\character-tables.php example.
As you can see in the attached i cannot print greek characters plus every code page has chinese characters in it.
I am using the default capability CapabilityProfile::load("default");
xprinter58.pdf

Also ran the following with no results.

vendor\mike42\escpos-php\example\specific\62-greek-symbol-swap.php
vendor\mike42\escpos-php\example\specific\50-P-822D-greek.php

May I ask how you produced those results @andrewshadura ?
Thank you in advance

@andrewshadura
Copy link
Contributor

@modosenin
Copy link

modosenin commented May 26, 2021

You help me? . I have an Xprinter 58IIHB printer. Download your project (thanks by the way). I am having trouble printing áéíóúñÑ characters.
Use a testing tool:
app_test01

Using advanced options I can print the CodePages. If I change the value zero to 1,2,3, I successively see different charsets
app_test02

The CodePage = 0 is:
codePage

But when I use the CapabilityProfile :: load ("POS-5890"):
$profile = CapabilityProfile::load("POS-5890");
$connector = new WindowsPrintConnector("XP-58");
$printer = new Printer($connector, $profile);
$printer->text("Acéntos y eñes\n");
$printer->feed(3);
$printer->close();

I see this:

error

@stefpap
Copy link

stefpap commented May 27, 2021

Hey @modosenin, not sure if this will help but this is how I managed to tackle my problem. There is a Chinese character mode which I had to turn off to print the characters I wanted. The only documentation about this I managed to find was here: http://xinyeprinter.com.cn/xprinter/help/zhilingji.html

Turn off Chinese character mode: 1F 1B 1F FE 01 00

Hope this helps : )

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

No branches or pull requests

5 participants