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
Direct print implementation #37
Comments
If you end up with something, I'd be happy to integrate it into this plugin. |
@TristanPct Could you make something that works? |
Hi, I'm still investigating on this. EDIT: replacing |
The iOS code is now full Swift. |
I saw it recently, I rebase my fork to continue with the Swift version, but the issue is still there for the moment... |
Problem seems to come from:
On a normal print (with print preview) invokeMethod is called and trigger the Dart onLayout callback, but using the direct print invokeMethod is called but the Dart callback is never triggered...(And lock?.unlock() is not called so the UI stays frozen.)
A breakpoint here is never hit with direct print: dart_pdf/printing/lib/src/printing.dart Line 26 in 924ff54
Have you an idea why in this use case the |
It is because controller.print does not spawn a new thread and you are stuck in a deadlock. The best would be to:
If we can also have a list of printers on the dart side, that would be better instead of relying on iOS default interface, but that's the second part. Then we need the same for Android ;) |
I'm not very comfortable with Swift (first time using it, same with Objective-C), I don't fully understand the thread system here... On the code, I've not look yet for a Dart side list of printers, I don't know if you can get printer without using native UI. For Android a native printer picker UI exist but apparently no native way to make a background print... |
I'm not the most experienced iOS developer too. |
I tried all combinations of For what I understood, a first lock is needed before Also, |
Yes, it was quite tricky to make it work correctly with the print dialog. The Android version is much more simple. |
i am working on Windows and Mac versions, so a NON Native Print Window is really helpful. Will let you knwo when i get somewhere with it. |
NON-Native Print Window seems to be impossible with Android, and Apple messed-up the threading model on iOS and it is hard to say if it will be possible. By the way, AHHHHHHHHH 😱!!!! |
no worries :) I ended up using the Native PDF Viewer for now on desktop. Life is too short ! What about this as a quick and dirty one for now... |
Implemented in Printing version 2.1.7 |
Is there a way to hide the |
I don't think it's possible. This is part of iOS, not the plugin. |
I'm currently developing an iOS Flutter app who need background printing.
I look at this plugin and starting a fork to implement the iOS
UIPrintInteractionController
printToPrinter
method allowing to print without showing the native UI.I simply made a copy of
printPdf
method (inPrintingPlugin.m
) and replacingwith
Having
printerID
aNSString
passed as parameter.But when I call this method, a popup show up saying:
And the popups "Cancel" button doesn't work...
Anyone seeing what's happens?
Here is my fork with
PrintingPlugin.m
andprinting/example
modified: https://github.com/TristanPct/dart_pdfHere is the StackOverflow issue referencing the same issue: https://stackoverflow.com/questions/54810047/ios-uiprintinteractioncontroller-printtoprinter-contacting-printer
The text was updated successfully, but these errors were encountered: