How to Print Unsupported Character Sets with a POS Printer: Difference between revisions

From wizarPOS
(Replaced content with "{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/printer/print-unsupported-character-sets}}")
Tag: Replaced
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
There are two ways to print html content, if your app is using our C SDK, please use the java method in JNI API, and if using our Java SDK, please use the Java method.
{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/printer/print-unsupported-character-sets}}
Please add WebView.enableSlowWholeDocumentDraw() in your APP source code, because we use android webview to print html content.
== Permission ==
android.permission.SYSTEM_ALERT_WINDOW
 
The app declares the permission in the manifest.
 
== By JNI API ==
=== API Overview ===
==== <big>PrintHtmlInterface.printHTML</big>====
  <syntaxhighlight lang="java">void printHTML(Context context, String htmlcontent, PrinterHtmlListener listener);</syntaxhighlight>
Print HTML content.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
| context|| '''Context :''' The activity or application context of the APP, Not null.
|-
| htmlcontent|| '''String :''' The html content, Not null.
|-
|  listener|| '''PrinterHtmlListener :''' the callback listener to process the print result, Not null.
|}
 
==== <big>PrintHtmlInterface.convert2Image</big>====
  <syntaxhighlight lang="java">void convert2Image(Context context, String htmlContent, PrinterHtmlListener listener);</syntaxhighlight>
Convert the html content to a image, if want print, please call print api of the printer.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
| context|| '''Context :''' The activity or application context of the APP, Not null.
|-
| htmlcontent|| '''String :''' The html content, Not null.
|-
|  listener|| '''PrinterHtmlListener :''' the callback listener to process the print result, Not null.
|}
 
==== <big>PrinterHtmlListener.onGet</big>====
  <syntaxhighlight lang="java">void onGet(Bitmap returbitmap, int result);</syntaxhighlight>
Get returned bitmap.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
| returbitmap|| '''Bitmap :''' The returned bitmap.
|-
| result|| '''int:''' The result of get image, "2:" BITMAP_ERROR, "3:" BITMAP_SUCCESS.
|}
 
==== <big>PrinterHtmlListener.onFinishPrinting</big>====
  <syntaxhighlight lang="java">void onFinishPrinting(int result);</syntaxhighlight>
Return after print.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
| result|| '''int :''' The result of the print,"0:" PRINT_ERROR, "1:" PRINT_SUCCESS,"2:" BITMAP_ERROR, "3:" BITMAP_SUCCESS,"4:" DEVICE_NOT_OPEN.
|}
=== Sample ===
Please find the sample in SDK folder, \cloudpos_SDK\device\c\sample\APIdemo_JNI_AS.
 
== by Java API ==
Please refer to java [http://{{SERVERNAME}}/wizarposapi/ API Spec].
in our demo from SDK folder \cloudpos_SDK\device\java\sample\APIDemoForAar, there is a printHtml method in com.wizarpos.apidemo.action.PrinterAction.java, you can call like it.

Latest revision as of 07:39, 7 April 2024

Please visit new link of same subject:

https://smartpossdk.gitbook.io/cloudpossdk/faq/printer/print-unsupported-character-sets

We're making a move! Our site's content is migrating to a new URL, to provide you with an enhanced browsing experience. Please update your bookmarks accordingly. Thank you for your continuous support!