question

signup avatar image
signup asked signup commented

what is print format

I need to construct my own print receipt.where some text should be centre align ,left align, right align ,some text should be bold . kindly help me out how can i achieve this

Thanks Isha shahu

Query:- What is the print format?

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered signup commented

If you want to format your own receipt, you can either,

  1. Use TextPrintJob. You can send simple lines of text. Any formatting has to be achieved by adding spaces and blank lines, etc.
  2. Use ViewPrintJob. This allows you to format the receipt using formatting mechanisms available via the Android View hierarchy.
  3. Use ImagePrintJob. Here you send an Android Bitmap, and how you format the pixels therein is up to you.
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

signup avatar image signup commented ·

Hello jeff,Thanks for reply. I have check ViewPrintJob but unable to find sample code..if you have any sample code or reference link.Kindly provide, Thanks

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

There is no sample for that. What's your question?

PrintJob pj = new ViewPrintJob.Builder().view(view).print(...);

As for how to construct the view, that's a general Android question that you'd be better off consulting the developer resources offered by Google.

0 Likes 0 ·

Welcome to the
Clover Developer Community