How to print to a bluetooth thermal printer?

xdev16xdev16 USMember ✭✭

My Xamarin forms app needs to print labels to a thermal printer (Brother QL 820 NW). I am creating a label in webview and then printing it. I am able to print the labels over wifi using the code below.
Now, I want to print the using bluetooth. The printer is already paired with the iOS device. How can I achieve this? Thanks!

            string printerIP = "10.10.1.100";
            var printInfo = UIPrintInfo.PrintInfo;
            printInfo.OutputType = UIPrintInfoOutputType.General;
            printInfo.JobName = "My label Print";
            printInfo.Orientation = UIPrintInfoOrientation.Landscape;
            printInfo.Duplex = UIPrintInfoDuplex.None;

            var printController = UIPrintInteractionController.SharedPrintController;
            var url = NSUrl.FromString (@"http://" + printerIP + ":631/ipp/print");
            var printerObj = UIPrinter.FromUrl (url);
            printController.PrintInfo = printInfo;
            printController.PrintFormatter = webview.ViewPrintFormatter;

            bool success = printController.PrintToPrinter (printerObj, (handler, completed, error) => {...});

Answers

  • Suneelkumar_BSuneelkumar_B USMember ✭✭

    Hi @xdev16 ,

    I am also looking for such scenario. Please help me by sharing that code.

    Thanks,
    Suneel Kumar Biyyapu.

Sign In or Register to comment.