krushkamx / nativescript-hprt Goto Github PK
View Code? Open in Web Editor NEWPrint to thermal printers from HPRT in your Nativescript application https://www.hprt.com/
License: MIT License
Print to thermal printers from HPRT in your Nativescript application https://www.hprt.com/
License: MIT License
Hi, thanks for you're grate plugin.
I use this plugin and can connect and use but just can connect to paired devices.
how can discovering unpaired devices?
I know it's not tested, but it should work?
Hi, I need print via IP address Can I do it with using this plugin?
Hi,
Isn't support nativescript version 4.0?
I need using Android and IOS device to print the recipe, and I tested in nativescript-star-printer , it no support using Xprinter printer. Currently I using this plugin to print at android is no problem but IOS can't , is it this plugin still got update ?
Hi,
I would like to build these functionalities with this Plugin. Guide me how to implement below features. Appreciate your help on this.
Thank you.
How can we get it worked for all Bluetooth printers ? I need to connect and print on 4 inch, 5 inch and 8 inch and x -inch paper. How do i get the paper width dynamically ?
Hi everyone, I'm trying to use a thermal printer but I keep on getting the below error.
The application can connect to the bluetooth printer.
I've also installed other applications from the playstore on my phone just to see if I can print on the thermal printer and they all can print however, when I use this lib, my application cannot print.
I have created a folder under *project/src/app/workers and also created files(enable-bluetooth.js, connect-printer.js)
JS: Error Error: com.tns.NativeScriptException: Failed to find module: "./workers/enable-bluetooth", relative to: app//
JS: Printer found = {
JS: "portName": "A0:E6:F8:34:1E:99",
JS: "modelName": "XX706*"
JS: }
JS: Connect error Error: com.tns.NativeScriptException: Failed to find module: "./workers/connect-printer", relative to: app//
JS: ERROR Error: Uncaught (in promise): Error: java.lang.NullPointerException: Attempt to invoke interface method 'int HPRTAndroidSDK.IPort.WriteData(byte[], int)' on a null object reference
JS: push.../node_modules/nativescript-hprt/hprt.js.Hprt.horizontalLine(file: node_modules/nativescript-hprt/hprt.android.js:204:0)
JS: at webpackHotUpdate../app/home/home.component.ts.HomeComponent.printText(file: src/app/home/home.component.ts:138:18)
JS: at webpackHotUpdate../app/home/home.component.ts.HomeComponent.connect(file: src/app/home/home.component.ts:79:13)
JS: at HomeComponent(file: src/app/home/home.component.ts:63:13)
JS: at createClass(file: node_modules/@angular/core/fesm5/core.js:21158:0)
JS: at createDirectiveInstance(file: node_modules/@angular/core/fesm5/core.js:21027:0)
JS: at createViewNodes(file: node_modules/@angular/core/fesm5/core.js:29387:0)
I have the 1.0.1.1801PRO.jar for hprt. The jar is missing the header files though that this version has. Been trying to work on an updated version for this plugin but not having much luck. How did you generate the header files from the given jar?
Hi @krushkamx
First of all, thank you for the great plugin, it has helped us immensely on the current project.
I am trying to connect to multiple devices but iterating through the search printer results I realise that the results are basically all devices paired in the past, and when I connect with the results using HPRT.connect(result) it basically allows me to connect even when the device is switched off - that is to say, even for the devices that are switched off it goes in the then() instead of catch(). Can you please shed some light on this, is this expected behaviour.
Regards
Rahul
Hi, this plugin doen't work with nativescript-vue.
will there be updates?
Thanks in advance
P
Hello excellent framework has helped me a lot in what I need, would you know how to print an image using the sdk? I would really appreciate it very much.
I have obtained this document but I have not managed to make it work, it is also possible to print an external image through some url.
Getting an issue on angular when this line is called, any advice.
Hi,
I added the config as mentioned in the above documentation.. I also see it is getting copied in webpack.. but still same issue
app/workers/connect-printer.js 321 bytes [emitted] bundle.js 43.6 KiB bundle [emitted] bundle package.json 2.31 KiB [emitted] runtime.js 77.1 KiB runtime [emitted] runtime tns-java-classes.js 0 bytes [emitted] vendor.js 17.2 MiB vendor [emitted] vendor Entrypoint bundle = runtime.js vendor.js bundle.js [../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built] [./app.css] 1.2 KiB {bundle} [built] [./app/app-routing.module.tns.ts] 1.39 KiB {bundle} [built] [./app/app.component.tns.ts] 7.25 KiB {bundle} [built] [./app/app.module.tns.ts] 1.73 KiB {bundle} [built] [./app/auto-generated/auto-generated.component.ts] 1.15 KiB {bundle} [built] [./main.tns.ts] 2.31 KiB {bundle} [built] [~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built] + 563 hidden modules Webpack compilation complete. Watching for file changes. Webpack build done! Updating runtime package.json with configuration values...
Hi,
I have created new application in that i need printing option using its Bluetooth feature in both android and ios app in native-script(typescript) , currently i am using nativescript-hprt plugin to print simple text using Zebra imz320 printer but i am not able to print anything, its connecting to printer successfully but when i try to print it shows success but nothing is printing .
Any help would be appreciated
Thank you
I'm using nativescript vue with webpack.
The module is installed, and searchPrinters() is working, but when I try to connect a printer I got this error:
'Connect error' [Error: com.tns.NativeScriptException: Failed to find module: "./workers/connect-printer", relative to: app// JS: com.tns.Module.resolvePathHelper(Module.java:146) JS: com.tns.Module.resolvePath(Module.java:55) JS: com.tns.Runtime.callJSMethodNative(Native Method) JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116) JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:996) JS: com.tns.Runtime.callJSMethod(Runtime.java:983) JS: com.tns.Runtime.callJSMethod(Runtime.java:967) JS: com.tns.Runtime.callJSMethod(Runtime.java:959) JS: com.tns.gen.android.content.DialogInterface_OnClickListener.onClick(DialogInterface_OnClickListener.java:17) JS: com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1168) JS: android.widget.AdapterView.performItemClick(AdapterView.java:321) JS: android.widget.AbsListView.performItemClick(AbsListView.java:1217) JS: android.widget.AbsListView$PerformClick.run(AbsListView.java:3203) JS: android.widget.AbsListView$3.run(AbsListVi...
I don't know if it is a bug or I'm not using it correctly, but I will be grateful for solution suggestions.
Hi!! im trying to create an app with svelte native, to use on sunmi V2 pro android device, but im getting this error when install this script.
Error: Cannot find module rxjs/Observable File: (file:///data/data/org.nativescript.posprint/files/app/vendor.js:53249:89)
I also had the following error: Error: Cannot find module 'utils/utils' which I think I have solved with
webpack.chainWebpack((config) => {
config.resolve.alias.set(
"@nativescript/core/utils/utils",
"@nativescript/core/utils"
);
config.resolve.alias.set("utils/utils", "@nativescript/core/utils");
config.resolve.alias.set(
"tns-core-modules/utils/utils",
"@nativescript/core/utils"
);
config.resolve.alias.set("tns-core-modules", "@nativescript/core");
});
Any idea how I can solve these problems?
Hi, I'm facing an issue to print. I modified the code to connect to a wifi printer. It's connected but it caused an error when I try to print. am I missing something? Is it because some settings for bluetooth? I don't have any idea
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onClick failed
System.err: Error: android.os.NetworkOnMainThreadException
System.err:
System.err: StackTrace:
System.err: Hprt.printText(file: node_modules/nativescript-hprt/hprt.android.js:190:45)
System.err: at invokeWithErrorHandling(file: node_modules/nativescript-vue/dist/index.js:3364:25)
System.err: at invoker(file: node_modules/nativescript-vue/dist/index.js:4030:13)
System.err: at Observable.notify(file: node_modules/@nativescript/core/data/observable/observable.js:110:22)
System.err: at Observable._emit(file: node_modules/@nativescript/core/data/observable/observable.js:127:17)
System.err: at ClickListenerImpl.onClick(file: node_modules/@nativescript/core/ui/button/button.android.js:29:22)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err: at com.tns.gen.java.lang.Object_vendor_18382_26_ClickListenerImpl.onClick(Object_vendor_18382_26_ClickListenerImpl.java:18)
System.err: at android.view.View.performClick(View.java:6308)
System.err: at android.widget.TextView.performClick(TextView.java:11202)
System.err: at android.view.View$PerformClick.run(View.java:23969)
System.err: at android.os.Handler.handleCallback(Handler.java:751)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6823)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
System.err: Caused by: android.os.NetworkOnMainThreadException
System.err: at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
System.err: at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
System.err: at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
System.err: at HPRTAndroidSDK.WiFiOperator.WriteData(WiFiOperator.java:210)
System.err: at HPRTAndroidSDK.WiFiOperator.WriteData(WiFiOperator.java:192)
System.err: at HPRTAndroidSDK.HPRTPrinterHelper.PrintText(HPRTPrinterHelper.java:2394)
System.err: ... 17 more
Is it possible to use this plugin with nativescript and pure js?
ERROR Error: Uncaught (in promise): ReferenceError: HPRTAndroidSDK is not defined
i using demo version and migrate to latest version, all connect is fine but when printing will shown out the error message
JS: ERROR Error: java.lang.NullPointerException: Attempt to invoke interface method 'int HPRTAndroidSDK.IPort.WriteData(byte[], int)' on a null object reference
JS: HPRTAndroidSDK.HPRTPrinterHelper.PrintText(HPRTPrinterHelper.java:2394)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1109)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1089)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1081)
JS: com.tns.gen.java.lang.Object_vendor_115390_32_ClickListenerImpl.onClick(Object_vendor_115390_32_ClickListenerImpl.java:18)
JS: android.view.View.performClick(View.java:6663)
JS: android.view.View.performClickInternal(View.java:6635)
JS: android.view.View.access$3100(View.java:794)
JS: android.view.View$PerformClick.run(View.java:26199)
JS: android.os.Handler.handleCallback(Handler.java:907)
JS: android.os.Handler.dispatchMessage(Handler.java:105)
is it need use new hprt jar file or ?
it worked for my printer but i am still trying to figure out how to print an image..please kindly help me ?..ill really apreaciate it
Hi,
I using hprt plugin in valilla nativescript but the error occur. But I try in angular nativescript, it work.
"nativescript": {
"id": "org.nativescript.testing",
"tns-android": {
"version": "3.4.1"
}
},
"dependencies": {
"nativescript-hprt": "^0.9.7",
"nativescript-pro-ui": "^3.3.0",
"nativescript-theme-core": "~1.0.4",
"tns-core-modules": "~3.4.0"
}
var Hprt= require("nativescript-hprt");
I just put inside this code then error occur.
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.testing/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Failed to find module: "rxjs/Observable", relative to: app/tns_modules/
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
System.err: at android.app.ActivityThread.access$900(ActivityThread.java:154)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: at android.os.Looper.loop(Looper.java:224)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5526)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.