Starting with Android 4.4 you can print documents from a device to a hardware printer via wifi.
Android apps can now print any type of content over Wi-Fi or cloud-hosted services such as Google Cloud Print. In print-enabled apps, users can discover available printers, change paper sizes, choose specific pages to print, and print almost any kind of document, image, or file.
A brief example of how to start the printing process:
private void doPrint() {
PrintManager printManager = (PrintManager) getActivity().getSystemService(Context.PRINT_SERVICE);
printManager.print("My document", new CustomPrintDocumentAdapter(getActivity()), null);
}
where CustomPrintDocumentAdapter extends PrintDocumentAdapter.
More information is available on Android Developers.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…