Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:37:42+00:00 2026-05-30T09:37:42+00:00

I want to send an Android Bitmap to a printer (Mobile Bluetooth Printer Bixolon

  • 0

I want to send an Android Bitmap to a printer (Mobile Bluetooth Printer Bixolon SPP R-200) using their SDK I can convert the Bitmap to a byte Array. For reference purposes (and to understand what I am taking about) check out the Bixolon Command manual here. And this is how I proceed:

Send a command to the printer, to tell it, how I want my printout to be aligned (left = 0, right = 2, center = 1) using the following command:

    byte[] command = { 27, 97, 0 };

The 27 and 97 are a command from the Bixolon Command manual – the zero means “left aligned”. I then send this command to the printer using the SDKs write(byte[]) command (which succeeds).

The next step is where I am having trouble: I want to send the “Print raster bit image” command to the printer and the first part is easy:

    byte[] command2 = { 29, 118, 48, 0, 0, 0, 0, 0 };

The 29, 118 and 48 together make up the command called “GS v 0” (literal translation when using a ascii conversion chart on the above numbers) which is described on page 126 in the referenced Bixolon manual. The first zero sets the horizontal and vertical DPI to 203.

Now the part I am stuck with: According to the manual, the remaining 4 zeros have to be replaced by:

xL  xH  yL  yH  d1...d 

which I assume to be x Position Low Byte, x Position High Byte, y position Low byte etc… (not sure what d1…d stands for though?).

In the SDK they’re filling those last 4 Bytes with the following code:

    int width = myBitmap.getWidth();
    int height = myBitmap.getHeight();
    int bytesOfWidth = width / 8 + (width % 8 != 0 ? 1 : 0);

    dimensionCommand[4] = (byte) (bytesOfWidth % 256);
    dimensionCommand[5] = (byte) (bytesOfWidth / 256);
    dimensionCommand[6] = (byte) (height % 256);
    dimensionCommand[7] = (byte) (height / 256);

But I don’t understand why. Is this how you calculate the high and low bytes of the x/y positions?

However – sending this command to the printer works too, and in the last step my Bitmap that has been converted to a byte array get’s successfully transferred as well (at least no IO Error occurs), but nothing is being printed (although the paper moves and there seem to be two pixels being printed on the left side of the paper). So I suspected maybe the above calculation of the high and low bytes for the x and y coordinates of the Bitmap are wrong…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:37:43+00:00Added an answer on May 30, 2026 at 9:37 am

    Lines

    int bytesOfWidth = width / 8 + (width % 8 != 0 ? 1 : 0);
    dimensionCommand[4] = (byte) (bytesOfWidth % 256);
    dimensionCommand[5] = (byte) (bytesOfWidth / 256);
    

    look suspicious. I would use the same computation for width as there’s for height. I would also use bitwise AND and bit-shift instead of % and / operators, which are rather slow in comparison:

    int width = myBitmap.getWidth();
    int height = myBitmap.getHeight();
    
    dimensionCommand[4] = (byte) (width & 0xFF);
    dimensionCommand[5] = (byte) ((width >> 8) & 0xFF);
    dimensionCommand[6] = (byte) (height & 0xFF);
    dimensionCommand[7] = (byte) ((height >> 8) & 0xff);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ACRA for Android, and I want to send the crash reports to
I want to send messages from android phone by using putty. Is that possible?
I want to send multipart form in my android app but without using org.apache.http.entity.mime
I want to send a csv file from Android to Python AppEngine. I'm using
I want to Send AT Command to Android phone. I know SDK does not
I'm writing an Android application that I want to be able to send requests
I want to send an image from one android device to one or multiple
I want to send a double value from my android client to the PHP
I want to send data to server from client(Android), below is my format http://101.34.45.45/rawData?data={userId:guest1,timestamp:2010-07-01
I want to send a username and password to a php page in android.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.