Hi, I am looking for a way to do some simple format, namely bold and align to the right for text printed on receipt using ReceiptRegistrationProvider extends ContentProvider in the com.clover.example.receipteditexample;
Hi, I am looking for a way to do some simple format, namely bold and align to the right for text printed on receipt using ReceiptRegistrationProvider extends ContentProvider in the com.clover.example.receipteditexample;
You have two choices w/ the Receipt Registration facility. Plain text, or a bitmap. If you need formatting more complex than plain text, you need to draw the text yourself on a Canvas
(for example) and write the Canvas
to a Bitmap
.
Hi Jeff.
I used your suggestion to create receipt content on Clover Mini device but my receipt content is not in the same format with the default content.
You can see this image for more information. I don't have enough 10 points to upload image into this question. I'm sorry for that :)
https://goo.gl/photos/tGk1D39rAVqxDWAZ8
The left one is your default receipt, the right one is my receipt.
The first question is how can i format my receipt like yours?
This is my canvas set up:
Bitmap bitmap = Bitmap.createBitmap(PAPER_WIDTH, PAPER_HEIGHT, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
bitmap.eraseColor(Color.BLACK);
canvas.drawColor(Color.GRAY);
paint.setColor(Color.BLACK);
paint.setTextAlign(Paint.Align.CENTER);
paint.setTextSize(22);
// i think my problem is here, i'm not using the same font style with your default receipt.
paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
The second question is how did you print the statement "I agree to pay...merchant agreement" in center alignment? Don't tell me that you cut the statement into 3 strings and write it on canvas with 3 canvas.drawText code line. :)
Thanks.
Hau.
No one has followed this question yet.