首页 > 解决方案 > 在 Android 中使用 Star Micronics 打印机无法打印多语言收据

问题描述

我尝试使用所有 CodePageType 和 CharSet 来打印阿拉伯语、日语等语言,但它在收据上打印了一些符号。对于英语,它可以使用所需的格式正常工作。我还关注了官方 pdf 和 appendInternationalCode() 等方法,但没有工作。 在此处输入图像描述

Star Micronics (SM230I) 打印机

StarPRNTSDK Android SDK

Android API 26 至 29

尝试了 UTF-8、Shift-JIS、JIS、ASCII 等。

尝试以下 CodePageType

    //Some method calling......  

  Charset encoding;
  StringBuffer stringBuffer=new StringBuffer();
  ArrayList<CodePageType> codeList=new ArrayList<>();
  codeList.add(CodePageType.CP437);
  codeList.add(CodePageType.CP737);
  codeList.add(CodePageType.CP772);
  codeList.add(CodePageType.CP774);
  codeList.add(CodePageType.CP851);
  codeList.add(CodePageType.CP852);
  codeList.add(CodePageType.CP855);
  codeList.add(CodePageType.CP857);
  codeList.add(CodePageType.CP858);
  codeList.add(CodePageType.CP860);
  codeList.add(CodePageType.CP861);
  codeList.add(CodePageType.CP862);
  codeList.add(CodePageType.CP863);
  codeList.add(CodePageType.CP864);
  codeList.add(CodePageType.CP865);
  codeList.add(CodePageType.CP866);
  codeList.add(CodePageType.CP869);
  codeList.add(CodePageType.CP874);
  codeList.add(CodePageType.CP928);
  codeList.add(CodePageType.CP932);
  codeList.add(CodePageType.CP998);
  codeList.add(CodePageType.CP999);
  codeList.add(CodePageType.CP1001);
  codeList.add(CodePageType.CP1250);
  codeList.add(CodePageType.CP1251);
  codeList.add(CodePageType.CP1252);
  codeList.add(CodePageType.CP2001);
  codeList.add(CodePageType.CP3001);
  codeList.add(CodePageType.CP3002);
  codeList.add(CodePageType.CP3011);
  codeList.add(CodePageType.CP3012);
  codeList.add(CodePageType.CP3021);
  codeList.add(CodePageType.CP3041);
  codeList.add(CodePageType.CP3840);
  codeList.add(CodePageType.CP3841);
  codeList.add(CodePageType.CP3843);
  codeList.add(CodePageType.CP3844);
  codeList.add(CodePageType.CP3845);
  codeList.add(CodePageType.CP3846);
  codeList.add(CodePageType.CP3847);
  codeList.add(CodePageType.CP3848);
  codeList.add(CodePageType.UTF8);

  //encoding = Charset.forName("JIS");
  encoding=Charset.forName("Shift-JIS");
  //encoding = Charset.forName("UTF-8");
  //encoding = Charset.forName("ASCII");

  for(CodePageType pageType:codeList)
  {
     builder.appendCodePage(pageType);
     stringBuffer.append("عنوان"+" = "+encoding+" = "+pageType);
     stringBuffer.append("\n");
  }
  builder.append(stringBuffer.toString().getBytes(encoding));

//print receipt ....

我需要以阿拉伯语、日语、中文、荷兰语等多种语言打印,目前它仅适用于英语和所有其他打印符号。TIA

标签: androidprinting

解决方案


IDisplayCommandBuilder builder1 = StarIoExt.createDisplayCommandBuilder(StarIoExt.DisplayModel.SCD222);
builder1.appendCodePage(IDisplayCommandBuilder.CodePageType.Japanese);
builder1.append("eewrdew こんにちは".getBytes(Charset.forName("Shift-JIS")));
builder1.appendCodePage(IDisplayCommandBuilder.CodePageType.Japanese);
builder1.append("eewrdew こんにちは".getBytes(Charset.forName("JIS")));
builder1.getPassThroughCommands();

我什至试过这个,但直到现在还没有找到任何解决方案。


推荐阅读