Protocols for Printing from Mobile Devices
Total Page:16
File Type:pdf, Size:1020Kb
Masaryk University Faculty of Informatics Protocols for printing from mobile devices Master’s Thesis Bc. Petr Bartoň Brno, Spring 2016 Replace this page with a copy of the official signed thesis assignment and the copy of the Statement of an Author. Declaration Hereby I declare that this paper is my original authorial work, which I have worked out on my own. All sources, references, and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Bc. Petr Bartoň Advisor: Mgr. Juraj Michálek i Acknowledgement I would love to thank my supervisor Mgr. Juraj Michálek, and all employees of Y Soft Corporation, who helped me with consultations, comments and a lot of useful advice during the creation of this thesis. iii Abstract This thesis investigates possibilities of printing on mobile platforms and describes available protocols for printing and printer discovery. The first part of this thesis covers the printing and discovery protocols in general and the second part describes the mobile operating systems Android, iOS, Windows 10 Mobile, Firefox OS and Ubuntu Touch. The main emphasis is put on Android because it is the most popular platform and does not have a full native printing solution. iv Keywords print, printing, protocols, IPP, Internet Printing Protocol, WS-Print, Zeroconf, mDNS, DNS-SD, WS-Discovery, Android, iOS, Windows 10 Mobile, Windows Phone, Ubuntu Touch, Ubuntu Phone, Ubuntu Tablet, Firefox OS v Contents 1 Introduction 1 2 Printing protocols 3 2.1 Line Printer Daemon Protocol ................3 2.1.1 Structure of messages . .3 2.1.2 Available messages . .4 2.1.3 Summary . .4 2.2 Internet Printing Protocol ..................4 2.2.1 Structure of messages . .4 2.3 WS-Print ...........................6 2.3.1 Structure of messages . .6 2.4 Summary ...........................7 3 Printer discovery 9 3.1 Zero Configuration Networking ...............9 3.1.1 Individual parts of Zeroconf . .9 3.2 Zero Configuration Networking solutions .......... 12 3.3 WS-Discovery ......................... 12 3.4 Comparison of discovery protocols .............. 14 4 IPP Everywhere 15 5 Android 17 5.1 Printing prior to Android 4.4 ................. 17 5.2 Printing on Android 4.4 and later .............. 18 5.3 Custom printservice ...................... 18 5.3.1 Requirements and limitations . 19 5.3.2 Manifest file . 19 5.3.3 PrintService class . 20 5.3.4 Managing printers in Android print service . 21 5.3.5 Handling the print job . 22 5.3.6 IPP implementation . 22 5.3.7 Authentication . 24 5.3.8 Ignoring the server certificate . 27 5.3.9 Testing the print service . 27 5.4 Existing print services .................... 28 vii 5.4.1 Let’s Print Droid . 28 5.4.2 PrintBot . 29 5.4.3 Mopria print service . 29 5.4.4 Google cloud print . 30 5.4.5 HP ePrint . 30 5.5 Printing application ..................... 31 5.5.1 Printing a bitmap image . 31 5.5.2 Printing an HTML document . 31 5.5.3 Printing a PDF document. 32 5.5.4 Printing a custom document . 32 5.6 Summary ........................... 32 6 iOS 33 6.1 AirPrint ............................ 33 6.2 Alternatives to AirPrint ................... 34 6.3 Custom printing application ................. 36 6.4 Summary ........................... 36 7 Windows 10 Mobile 37 7.1 Printing before Windows 10 Mobile ............. 37 7.2 Printing since Windows 10 mobile .............. 37 7.3 Alternatives to native printing ................ 38 7.4 Differences between the desktop and mobile version ofWin- dows 10 ............................ 39 7.5 Summary ........................... 39 8 Ubuntu Touch 41 8.1 Printing on Ubuntu Touch .................. 41 8.1.1 Printing dialog . 42 8.2 Summary ........................... 43 9 Firefox OS 45 9.1 Printing from Firefox OS ................... 45 9.2 Testing of Firefox OS ..................... 45 10 Conclusion 47 viii List of Tables 2.1 Beginning of IPP message attribute 5 2.2 IPP job-name opperation attribute 5 ix List of Figures 3.1 Message exchanges between a Target service and a Client. Source WS-Discovery documentation [15, p. 10] 13 5.1 System settings of a printing dialog on Android 20 5.2 Setting of the custom print service 23 6.1 Printing from iPhone 6s with iOS 9.3 34 6.2 Printing with HP ePrint from iPhone 6s with iOS 9.3 35 7.1 Printing from the Office application in Windows 10 Mobile 38 8.1 The initial draft of the printing dialog on Ubuntu phone 42 xi 1 Introduction The goal of this thesis is to map the possibilities of printing from mobile devices like smartphones and tablets. The main focus is on An- droid devices as Android is currently the most used operating system on mobile devices[1], but also less used operating systems or even new, not yet widely used, systems such as Firefox OS and Ubuntu Touch will be covered. Some people could question the necessity for mobile printing at all and argue that printing on mobile devices is not important. Since working with documents is more natural on computer or tablet, it is also better to print them from there. But there are also cases when users appreciate the ability to print from mobile devices, like printing an email they just received, or photo they just took without the need to go back to the computer. There are many reasons but finding the importance of mobile printing is not the goal of this thesis. The focus is on technical details of mobile printing and description of printing on each platform to- gether with the description of existing printing applications. In cases where printing is not yet available, the focus is on proposing possible solutions. First will be a brief description of printing protocols such as Line Printer Daemon Protocol, Internet Printing Protocol and WS-Print, to- gether with the comparison of parts of their communication and description of their differences. The next chapter will describe protocols used for printer discov- ery, which is of particular importance in the mobile world, because unlike with desktop computers, mobile devices are more likely to be used with different printers and manual set up of printers couldbe challenging for some users. The third chapter will be about IPP Everywhere[2] as a general standard for mobile printing. The focus will then aim at each platform individually starting with Android, describing specifics for different versions. A small imple- mentation of printing service, which can discover printers and also print to them, will be included as well. Because the thesis is realized 1 1. Introduction in cooperation with Y Soft Corporation, a.s., the printing service will be tested with IPP endpoint provided by Y Soft. The next platforms will be iOS, as the second most used mobile op- erating system[1] and Windows 10 Mobile1 by Microsoft as the third. Both these systems have a native printing solution in their latest ver- sion, so the work will focus on how the solutions work and also on other alternative printing applications. Last two chapters will briefly describe Ubuntu Touch by Canonical and Firefox OS by Mozilla. As these operating systems don’t have any native printing solution, the focus will be on the description of what was already done to achieve the print functionality and what is miss- ing. 1. It is specified in the assignment as the Windows Phone version, which is thename of the previous version of Windows 10 Mobile. 2 2 Printing protocols “Network Protocol is a set of rules that defines the format and the order of messages exchanged among two or more communicating entities, as well as the actions performed during sending/receiving that mes- sages.” [3, p. 13] Printing protocols are then just a special form of network protocols describing communication between printer, print server or the device the user is using to print. In the scope of mobile printing, these devices are smartphones or tablets. It is also possible to send a print job directly to the printer, often referred as RAW protocol, Jetdirect or 9100[4]. In reality, it is not a print- ing protocol but rather a way to send raw data of a print job to the printer on the port 9100. The data must be formatted using a Page Description Language supported by the printer. The following section describes LPR as one of the most basic print- ing protocols followed with IPP used by Apple in iOS and WS-Print used by Microsoft in Windows 10. 2.1 Line Printer Daemon Protocol Line Printer Daemon Protocol (further as LPR) is a TCP-based protocol described in RFC 1179 [5]. A line printer daemon is located on printer or print server and it is receiving messages on port 515. For every message new connection must be made, as these messages represent commands, which should be interpreted as statements. 2.1.1 Structure of messages The LPR messages always begin with a single octet code, represent- ing the requested function. After the command code, printer queue name has to be specified. Some commands then have another infor- mation which is located after the queue name. These are separated from the queue name with ASCII white space. End of the message is specified with ASCII line feed character. 3 2. Printing protocols 2.1.2 Available messages As LPR offers only limited control of the printing, the list of avail- able commands is relatively small. The main operations are Print any waiting jobs, Receive a printer job, Send queue state, Remove jobs. The pur- pose of these operations is self-explanatory, only Receive a printer job operation is special because printer expects to receive subcommands containing the job data file or control file.