Polaris + Printing – Kevin

During this past week, I devoted the majority of my time to working on the next Polaris major release (codename “NX”). Among the numerous features that will be made available, “remote printing” is the most requested. It will allow duty crew members to print attendance sheets directly through the Polaris cloud printing service, eliminating the need for the driver take attendance by hand with the van sign-out form.


While the feature might sound very simple to implement, the engineering behind is quite difficult. At first, I thought about using Google Cloud Print, which is compatible with almost all the printers at Westtown School. Unfortunately, after going thought Google Cloud Print’s API documentation, I realized that the sample code was published back in 2011. The majority of the features in the sample code have been either deprecated or made unavailable.

Soon, I was able to come up with a second solution, which is printing with third-party APIs or PHP libraries. There is quite a lot of PHP printer libraries available on GitHub. Before I decided to give this solution a try,  I stumbled upon an article on Stack Overflow, detailing the 4 ways to print a document with PHP. The first two methods detailed by the author were not applicable because Polaris runs neither PHP 5 nor on Windows Server. The last solution proposed by the author was also not applicable because it prompts the users to print through the system printing service, which defies the whole purpose of implementing the printing service through cloud.

This left me with the last option – option 3. The author writes that developers can open up a socket to print to any compatible printer on the network. Specifically, the author uses port 9100 and simply inputs the text and sends it to the printer via the HP JetDirect protocol. I was initially doubtful about this method and was surprised that it worked during my first attempt. The following is the code I wrote for my initial attempt:

$data = "Hello, Polaris.";
$conn = pfsockopen("",9100);

Moreover, While selecting the type of printer, I was torn apart between two the options I had: POS receipt printer and normal printer. My original thought was that a POS receipt printer would be more eco-friendly as it uses less paper. After a short conversation with T. Carl Beehler, I found out that, after all, printing letter-size attendance sheets might not be a bad idea. It turned out that thermal paper tends to go completely black when exposed to extreme heat. It is also more harmful to the environment than regular paper because of the use of chemicals, making it unrecyclable.

Thanks for reading my blog. I will be going on my senior project next week and will not be posting another blog post until I return from spring break. I am looking forward to sharing my experience of Yunnan Province, China with you.

Works Cited

Beehler, Carl. Interview. 26 Feb. 2018.

Google. “Cloud Print.” Google Cloud Print, Google, http://www.google.com/cloudprint/learn/. Accessed 25 Feb. 2018.

User3150191, and Jens A. Koch. “Printing Data to Printer Using PHP.” Stack Overflow, Stack Exchange, 11 Mar. 2014, stackoverflow.com/questions/22313439/printing-data-to-printer-using-php. Accessed 26 Feb. 2018.

One thought on “Polaris + Printing – Kevin

  1. Susan Waterhouse

    Glad to read about this plan, and to chat today about the continued development of this application. Printing lists from Polaris will be exciting and got good reception from faculty. I’m glad you learned a new computing skill for this, and encourage you to continue to stretch yourself to learn new things as you continue to work on this app development.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s