Xamarin Forms Receipt Printing (Tutorial)

  Переглядів 13,498

MrNawshad

MrNawshad

День тому

In this video, we will be learning how to print a receipt to a POS network printer from Xamarin forms iOS, Android and UWP application.
1. Background Music Link
• TIK TOK No Copyright M...

КОМЕНТАРІ: 85
@carljohnlopez5425
@carljohnlopez5425 2 роки тому
great video , this helps me alot , how do you format or put qr code in the output sir? do you have source code of font format and qr code ?
@najeebvannp
@najeebvannp 2 роки тому
Can I use the same method Print() for printing an image instead of IList
@zackcoolman1
@zackcoolman1 3 роки тому
How do i print image? print text has no problem on my app
@redinversati3924
@redinversati3924 2 роки тому
great!. How can i print pdf, or bitmap, or canvas image usign this socket connetion?
@kratos7ism
@kratos7ism 2 роки тому
Thank you so much bro . Your code works perfect . Although i have no problems printing or connecting to a printer it seems that when i use a A4 paper every word you pass as parameters is printed diagonally. Is there any way to fix that ??
@vivekhariharganj
@vivekhariharganj 3 роки тому
Thanks For Showing example. Please help me to print xamarin page , or if I have list of product object
@wlickez
@wlickez 2 роки тому
Thanks for this tuto, why do you use the 9100 port?
@MrNawshad
@MrNawshad 2 роки тому
hacking-printers.net/wiki/index.php/Port_9100_printing
@drackkeyner
@drackkeyner 2 роки тому
Amazing tutorial bro
@MrNawshad
@MrNawshad 2 роки тому
Glad you like it. Please share this content so others find it useful too. Thanks.
@diegoliterat8523
@diegoliterat8523 3 роки тому
Hi, i have question. how i can to get my IP address of my printer in the code? you set this in string, but if i need implement in App i need to get the IP Address.
@user-yq8ow5uz2e
@user-yq8ow5uz2e Рік тому
Thanks alot
@janakipriya7204
@janakipriya7204 Рік тому
hi i made webview i want to print that using android print manager on print preview page the webview contains white border at all place how to remove
@kratos7ism
@kratos7ism 2 роки тому
Is there any way to support printing International characters like Greek or Arabic?? English works fine but international characters are printed out like weird symbols.
@skyfiprog7200
@skyfiprog7200 2 роки тому
I need to try this, this kind of video is a big help for me, how to pay you if i need help
@chickenpoxtv3287
@chickenpoxtv3287 4 роки тому
Thank you
@MrNawshad
@MrNawshad 4 роки тому
I m glad you liked it.
@chickenpoxtv3287
@chickenpoxtv3287 4 роки тому
Can I have a question .. I'm using xamarin in Visual Studio windows version.. I got error using assembly : dependency above in the namespace and dependencyservice ? Can u make a tutorial?
@MrNawshad
@MrNawshad 3 роки тому
@@chickenpoxtv3287 could you be more specific about the error you are encountering. Thanks.
@chickenpoxtv3287
@chickenpoxtv3287 3 роки тому
@@MrNawshad this code is use to all POS printer brand?
@MrNawshad
@MrNawshad 3 роки тому
@@chickenpoxtv3287 yeah. As long as the printer supports ESC/POS commands. Which majority of the printer providers support.
@mohsenmohamed2281
@mohsenmohamed2281 3 роки тому
Why you made a class in each platform with the same implementation ? Why you didn't make just one class at the shared project and call the print() function from the button ?
@MrNawshad
@MrNawshad 2 роки тому
to show the use of dependency service. You could use the same code on the shared project and that would work the same way. Thanks
@wahyuadhilaksana6457
@wahyuadhilaksana6457 2 роки тому
Can I using Printer Brother DCP-T420W , Sir ? thank you
@MrNawshad
@MrNawshad 2 роки тому
yes, as long as its connected to your local network.
@venuqsconsultants3138
@venuqsconsultants3138 2 роки тому
when connecting to psocket.connect it is showing mistake "operation blocked "
@GianAlmeyda
@GianAlmeyda Рік тому
good contribution, it works for me, but I have problems cutting the paper, can you help me?
@MrNawshad
@MrNawshad Рік тому
for full cut send this command { 0x1d, 0x56, 0x00 }; // Full cut paper
@GianAlmeyda
@GianAlmeyda Рік тому
@@MrNawshad How do I apply it after outputList.Add(0x1d); outputList.Add(0x56); outputList.Add(0x00);
@GianAlmeyda
@GianAlmeyda Рік тому
@@MrNawshad Thanks, I was able to apply it, I was getting complicated, pSocket.Send(outputList.ToArray()); pSocket.Send(PrinterCommands.CUT_PAPER);
@mraak324
@mraak324 3 роки тому
I have done this using Bluetooth connectivity print is genrate but issue is half print coming first time then next time I am giving aging print comnad then last print half portion coming in current print Can you suggest me what I have to do for resolving the issue?
@MrNawshad
@MrNawshad 3 роки тому
It is a bit difficult to suggest something without looking at your code.
@mraak324
@mraak324 3 роки тому
@@MrNawshad public async Task Print(string deviceName, IList linesToPrint) { using (BluetoothAdapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter) { BluetoothDevice device = (from bd in bluetoothAdapter?.BondedDevices where bd?.Name == deviceName select bd).FirstOrDefault(); try { using (BluetoothSocket bluetoothSocket = device?. CreateRfcommSocketToServiceRecord( UUID.FromString("00001101-0000-1000-8000-00805f9b34fb"))) { List outputList = new List(); foreach (string txt in linesToPrint) { // Convert the strings to list of bytes outputList.AddRange(System.Text.Encoding.UTF8.GetBytes(txt)); // Add ECS/POS Print and line feed command outputList.Add(0x0A); ; } bluetoothSocket?.Connect(); if (bluetoothSocket.IsConnected) { Thread.Sleep(200); try { bluetoothSocket.OutputStream.Write(outputList.ToArray()); } catch (Exception e) { } //bluetoothSocket.OutputStream.Position = 0; //System.Threading.Thread.Sleep(5000); bluetoothSocket.OutputStream.Flush(); bluetoothSocket.OutputStream.Close(); bluetoothSocket.OutputStream.Dispose(); // bluetoothSocket.OutputStream.Position =0; bluetoothSocket.Close(); bluetoothSocket.Dispose(); } } } catch (Exception exp) { throw exp; } } }
@MrNawshad
@MrNawshad 3 роки тому
@@mraak324 use try catch finally for instance try { }catch { }finally{ bluetoothSocket.OutputStream.Flush(); bluetoothSocket.OutputStream.Close(); bluetoothSocket.OutputStream.Dispose(); // bluetoothSocket.OutputStream.Position =0; bluetoothSocket.Close(); bluetoothSocket.Dispose(); } see if this works. good luck. and let me know your result. thanks.
@mraak324
@mraak324 3 роки тому
@@MrNawshad hi Issue has been resolved I have update my printer firmware now print is coming perfectly Thank for your quick support Can we print pdf using above code ?
@By_Bestboy
@By_Bestboy 9 місяців тому
Hi. Could you please tell me how you obtain a bluetoothsocket in IOS?. Thank you.
@mestutosisptheophile8991
@mestutosisptheophile8991 2 роки тому
Can i use the same code to print on an handheld android terminal ????
@MrNawshad
@MrNawshad 2 роки тому
you need to connect to the device first, the printing commands are same for any devices. thanks.
@mestutosisptheophile8991
@mestutosisptheophile8991 2 роки тому
@@MrNawshad my terminal have an incorated printer so when i try your code i have the message connection refused.
@mestutosisptheophile8991
@mestutosisptheophile8991 2 роки тому
@@MrNawshad my android terminal has an incorporated printer but when i try your code by specifiying the ip adress and the port i get : connection refused, please what can i do ???
@MrNawshad
@MrNawshad 2 роки тому
@@mestutosisptheophile8991 I guess your terminal printer does not have an associated ip address, the ip address you are targeting is for the terminal itself. I think you have to print to this printer through USB communication. if you look into the terminal's manual they usually proved with printer sample code. thanks.
@mestutosisptheophile8991
@mestutosisptheophile8991 2 роки тому
@@MrNawshad i see the manual of the terminal it written android bluetooth terminal, when i activate bluetooth i see the printer name among connected devices, what can i do so ? thank you.
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
How to generate Collection View data in to PDF File in Xamarin.forms can u please make tutorial?
@MrNawshad
@MrNawshad 3 роки тому
Didn’t get what you are asking for.
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
@@MrNawshad OK let me explain I want create PDF file of my listview data items like receipt.
@MrNawshad
@MrNawshad 3 роки тому
And where would you like to save it?
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
@@MrNawshad I want to save it on my mobile device or send mail
@MrNawshad
@MrNawshad 3 роки тому
Ok. I understand now. Can’t promise on doing a video on it anytime sooner. But will definitely do it once I have my current projects sorted first.
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
hi please tell me ho to save web view data as pdf ?
@MrNawshad
@MrNawshad 3 роки тому
codemilltech.com/xamarin-forms-e-z-print/
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
@@MrNawshad I think this document is supported with older version of Xamarin. Can you please make a tutorial of how to print HTML Page with WebView.
@AMIRKHAN-dm2fm
@AMIRKHAN-dm2fm 3 роки тому
if you do that this is really helpful for me because my whole project is stuck on it. I have tried a lot of things but useless.
@ramanprajapati5266
@ramanprajapati5266 2 роки тому
Its not working.Can you update
@MrRobravens
@MrRobravens 2 роки тому
Bit useless using dependency service for this when the implementation is the same
@balajidj6184
@balajidj6184 3 роки тому
How to print from Android?
@MrNawshad
@MrNawshad 2 роки тому
implement the printer class on android and call the print method from the button event click handler.
@jooskesters9472
@jooskesters9472 3 роки тому
I followed this guide and my printer is not printing anything :/
@MrNawshad
@MrNawshad 3 роки тому
Make sure you target the right IP address of your printer.
@jooskesters9472
@jooskesters9472 3 роки тому
@@MrNawshad I connected the printer to my network. Got the ip printed out. Pinged the ip with my laptop to make sure. Than ran my app and tried to print.. Nothing comes out. Do I need certain drivers installed for this on my laptop or sth ?
@MrNawshad
@MrNawshad 3 роки тому
You need to configure the printer on your network.
@jooskesters9472
@jooskesters9472 3 роки тому
@@MrNawshad Do you have discord where I can ask you some questions during my troubleshooting ? I understand your response as going to my router page and look for the printer in the settins over there ?
@jooskesters9472
@jooskesters9472 3 роки тому
In the mean time. I just went to the configuration page of the printer. Logged in, and made sure the settings were right. To sum it up. Network mode: infrastructure mode, 9100 Multi session (tried enable and disable) both don't make a difference for making it work.
Barcode Scanner in Xamarin.Forms - Scan First Barcode under 10 Minutes
9:52
Xamarin Forms Bluetooth Receipt Printing
9:11
MrNawshad
Переглядів 9 тис.
Повістки у Києві: «Яке право вони мають забирати всіх мужиків?» #війна #мобілізація #військові
00:41
Слідство.Інфо | Розслідування, репортажі, викриття
Переглядів 1,6 млн
How to get a FREE HYPERCHARGE SKIN!
02:07
Brawl Stars
Переглядів 15 млн
Big Tech AI Is A Lie
16:56
Tina Huang
Переглядів 56 тис.
Xamarin Forms Print Receipt POS System Integration
7:04
Xamarin Guy
Переглядів 8 тис.
Google Data Center 360° Tour
8:29
Google Cloud Tech
Переглядів 5 млн
Popup in Xamarin Forms
10:42
Houssem Dellai
Переглядів 66 тис.
Xamarin Android Tutorial - Create PDF File and Print
38:40
EDMT Dev
Переглядів 24 тис.
Save and Show PDF Files with This Library in Xamarin.Forms
19:17
Gerald Versluis
Переглядів 19 тис.
Secure Your Xamarin App with Fingerprint or Face Recognition
24:02
Gerald Versluis
Переглядів 18 тис.
ИГРОВОЙ ПК от DEXP за 37 тысяч рублей из DNS
27:53
Ремонтяш
Переглядів 378 тис.
СМАРТФОНЫ HTC ВЕРНУЛИСЬ В 2024! Шок для Apple, Samsung и Xiaomi...
11:51
Thebox - о технике и гаджетах
Переглядів 30 тис.
Крутое обновление microReader!
5:54
Заметки Ардуинщика
Переглядів 24 тис.
Result of the portable iPhone electrical machine #hacks
1:01
KevKevKiwi
Переглядів 7 млн
RTX 4070 Super слишком хороша. Меня это бесит
15:22
Рома, Просто Рома
Переглядів 90 тис.