Reputation: 81
Simple Android App just developed. I have the printing functionality working in android version 4.4 via api google.
Anyway my final purpose is to print automatically to default printer without any ui interface. Print content is simple html. I need some custom code to resolve this issue.
Kind regards Danilo
Upvotes: 8
Views: 6647
Reputation:
Luckily I was able to override the method of print of PrintManager, however you cannot continue print or send the job to print without going to the intent command.
PrintJobInfo printJobInfo = bundleResult.getParcelable("android.print.intent.extra.EXTRA_PRINT_JOB");
IntentSender printIntent = bundleResult.getParcelable("android.print.intent.extra.EXTRA_PRINT_DIALOG_INTENT");
Unless if anyone here have an idea or suggestion how to deal with the intent. I can post the code on how I made my own print method of manager if requested, but its gonna be stuck on the printIntent. If we could just solve the printIntent then we might have a solution to this common problem of hiding the print dialog box.
Upvotes: 1
Reputation: 3768
I think, We can't able to hide that Print Dialog, coz, PrintManager class is final. So, We are not allowed to override that.
When you call this print(String, PrintDocumentAdapter, PrintAttributes) from an activity, It starts Print jobs also it will bringing up the system print UI.
If you want an example for Printing a Document you can refer to this Android-wifi-print - GitHub. This is just a prototype for printing a document using wifi printer.
Upvotes: 4