Android-USB-printer | print messages to any USB printer via android | 3D Printing library
kandi X-RAY | Android-USB-printer Summary
kandi X-RAY | Android-USB-printer Summary
This app can connect and print messages to any USB printer via android.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This method is called when the icicle is created
- Print a message
- Close the device
- Connects to the device
- Print the specified message
Android-USB-printer Key Features
Android-USB-printer Examples and Code Snippets
Community Discussions
Trending Discussions on Android-USB-printer
QUESTION
I'm having a project in android that need to print RAW text (to support ESC/P command) using UsbManager class. I did it using bulkTransfer, and the code looks like this. And now I should give an option to cancel the job. How can I do it?
I've tried to search and somehow I couldn't find it anywhere. And I'm new to android too. Thanks.
Edit:
The printer I use is Tally T5040 and Epson PLQ-30.
What I've tried is clear printer buffer by sending 0x18 (CANCEL DATA) command. But still no luck.
Edit 2:
Finally I was able to soft reset the printer (clearing all buffer) by using controlTransfer. The full command is controlTransfer(0x21, 2, 0, 0, null, 0, 0)
. I got the references from this site. But the problem right now is the reset command only work on Epson PLQ-30.
ANSWER
Answered 2019-Apr-09 at 11:47According to Universal Serial Bus Device Class Definition for Printing Devices, there is a Class-Specific Request called SOFT_RESET:
This class-specific request flushes all buffers and resets the Bulk OUT and Bulk IN pipes to their default states. Thisrequest clears all stall conditions. This reset does NOT change the USB addressing or USB configuration.
So you just need to send SOFT_RESET request using controlTransfer, the code is (Kotlin):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Android-USB-printer
You can use Android-USB-printer like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Android-USB-printer component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page