-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Printing UI for MAUI Windows/Android/iOS #9931
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
This is just plain non-sense to have a product released in market without basic printing capability available? (Been on Microsoft Tech Stack for entire career) |
this is one of strangest things , the printing is a very basic fuctionality but in maui android we can't do that , i developed an app for customer and i never think such simple thing not implmented yet ,for now it's seem maui app for android is very bad choice for enterprize application , please soon implmented it |
Hope this can be addressed soon. I too am working on a MAUI app that could use a native print preview dialog. |
Maybe considering it on the Toolkit? 👀 @brminnick |
That is insane you put .net MAUI out there without printer support. |
Es hilo se generó casi 1 año atras, es increible que despues de tanto tiempo todavía no haya solución, para imprimir, en windows encontre un solucion y funciona bien, pero para iOS y Android todavía nada, la verdad una verguenza. |
Its been one year now, still issues is not closed yet |
Do we have to wait for the MAUI successor to get printing capabilities? |
Cual es la solucion que haz encontrado, la puedes compartir ? |
Has anyone managed to find a workaround to print from MAUI application? |
#if MACCATALYST
using CoreGraphics;
using Foundation;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UIKit;
{
public class PrintonMac
{
public async void PrintImage(Stream img)
{
try
{
var data = NSData.FromStream(img);
var uiimage = UIImage.LoadFromData(data);
var printer = UIPrintInteractionController.SharedPrintController;
if (printer == null)
{
Debug.WriteLine("Printer is not connected");
}
else
{
var printInfo = UIPrintInfo.PrintInfo;
printInfo.OutputType = UIPrintInfoOutputType.General;
printer.PrintInfo = printInfo;
printer.PrintingItem = uiimage;
var handler = new UIPrintInteractionCompletionHandler((printInteractionController, completed, error) =>
{
if (completed)
{
Debug.WriteLine("Printer Success");
}
else if (!completed && error != null)
{
Debug.WriteLine("Print Failed");
}
});
CGRect frame = new CGRect();
frame.Size = uiimage.Size;
printer.Present(true, handler);
}
}
catch (Exception ex)
{
LogHandler.LogError(ex);
}
}
}
}
#endif in .cs on button event add #if MACCATALYST
var filepath = selectedImages.FirstOrDefault();
var openFile = System.IO.File.OpenRead(filepath);
_printServicesMac = new PrintServicesMac();
_printServicesMac.PrintImage(openFile); This will work for mac and IOS. |
I use this PrintDocumentAdapter but it works only with bitmap. I can print only image and pdf and it doesn't work perfectly. Has anyone found any other solution? |
I am in favour of creating a general cross-platform API for printing, which could serve as the basis for the MAUI implementation. Maybe you would like to share your thoughts under the following issue: |
No basic printing, that's the reason i'm moving to Flutter. It is great to speak about a cross-platform API for printing but after some years still nothing :( |
Any updates from the MAUI team? |
We also need this future for printing receipts and invoices |
There is already a great deal of interest in printing. Perhaps we should push this issue forward, which could serve as the base abstraction and implementation for MAUI. |
@deeprobin there are fixes on the way for XPS after ±10 years, planned to be included in .net 9 but the team doesn't review or make any progress anymore it seems... See: dotnet/runtime#97898 I wish you good luck with pushing issues forward, like I did in the last years... Guess printing and xps isn't as sexy as the projects that @davidfowl is working on and this is why they keep everything printing in some dark cave in Redmond. Really don't understand what is going on there at Microsoft. I hope @ericstj of @jeffhandley will follow up. |
@wstaelens I could imagine that Printing is also a place in the Windows Kernel that (understandably) nobody wants to deal with ... Does NT actually have a product owner / area owner for printing? |
@deeprobin I guess there is no more such a team like in the days with Feng Yuan, Bobby Mattappally, Ashwin, Alan Morris, Ron Martinsen etc... |
Does anyone found any 3d party plugin for this? At least for andoid? |
I am not familiar with MAUI in depth. However, the Android API itself offers printing functionality (package If the effort is not too great, you might implement e.g. some wrapper around this: |
It's been two years now, and no comment from MAUI. It seems funny to build on top of Windows and not support the print function on its main OS. The term Multi-platform App UI doesn't seem so right at this point |
Which platform do you need to print on? I don't have a workaround yet (only just looking to do this today), but something I'm going to try (and have had success with in a different context) is standing up a service on a Windows machine connected to the printer in question and submitting the request that way. It won't work for everybody in all situations but my use case is a LOB app so the users won't be moving around and printing from all different places, so I don't even need it to be done from the device directly. If I go down this route and it works I'll upload it in case it's useful to anybody else. |
On Android this works for us:
We use it to print barcodes from the app. Getting the html with javascript:
And calling the print function like this:
|
Description
MAUI is awesome. Some OA and LOB apps need basic functionalities like printing files (documents, images, receipts, etc.). Existing code which works for Xamarin raises puzzling exceptions when migrated to MAUI projects.
To my knowledge, there are no such libs for MAUI now. Any clues on how to get "printing by printer" functionality in MAUI (on Windows/Android/iOS)?
Thanks to the great Syncfusion team, a Xamarin Printing demo with sample project could be found, it works basically ok in Xamarin, but when migrated to MAUI, the Windows code raises exceptions like "Interface not registered", "Class not registered", etc. Some issues are solved by replacing UI Dispatcher with Dispatcher Queue, and using PrintManagerInterop; while still no clues on these "xxx not registered" issues. These issues seems to be raised due to switching to WindowsAppSDK WinUI3 in MAUI?
Note that the Android implementation above crashes with exception on MAUI, too.
Public API Changes
Developer pass a file stream / path to the API,
it popup a UI showing Printing preview/configurations.
Intended Use-Case
Many to-B and to-C apps (including warehouse management, line-of-business, office automation, retail apps) need the functionality of printing documents/receipts/invoices by passing a file to the printer.
The text was updated successfully, but these errors were encountered: