It may be more than a month past April Fools' Day, but there's never a bad time for a little humor and laughter around the office. After reading this post at kovaya.com, I decided to see if this innocent little trick with HP LaserJets actually works. Sure enough, it does! Using this Perl script, you can make the LCD screen on your HP LaserJet say whatever you want. And to top it all off, I successfully ported the app to PHP and put a nice little front end on it for your added convenience (err, enjoyment). Continue reading for the PHP code ...<?php
// Copyright (c) 2009 Mark S. Kolich
// http://mark.koli.ch
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
define("PORT","9100");
function showUI($ip="",$msg="INSERT COIN",$status=""){
?>
<html>
<head><title>Set HP Printer Display Message</title></head>
<body>
<?
if(!empty($status)){
?><h2><?= $status; ?></h2><?
}
?>
<form method="post" action="<?= $_SERVER['PHP_SELF']; ?>">
<strong>Printer IP Address:</strong><br/>
<input type="text" size="20" name="ip" value="<?= $ip; ?>">
<br/><br/>
<strong>Display Message:</strong><br/>
<input type="text" size="50" name="msg" value="<?= $msg; ?>">
<br/><br/>
<input type="submit" value="Set Message!">
</form>
</body>
</html>
<?
}
if( !empty($_POST['ip']) &&
!empty($_POST['msg']) ) {
$ip = $_POST['ip'];
$msg = $_POST['msg'];
$msg = addslashes($msg);
if (($longip = ip2long($ip)) !== false) {
if ($ip != long2ip($longip)) {
die("Invalid IP Entered!");
}
}
else {
die("Invalid IP Entered!");
}
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
die("socket_create() failed!");
}
$connection = socket_connect($socket, $ip, PORT);
if ($connection === false) {
die("socket_connect() failed!");
}
$out = "@PJL RDYMSG DISPLAY=\"$msg\"\r\n";
socket_write($socket, $out, strlen($out));
socket_close($socket);
showUI($_POST['ip'], $_POST['msg'],
"Message set successfully!");
}
else {
showUI();
}
?>
You can download the PHP here, too. Be safe you crazy kids.
Tested (and works) on the following printers ...
- HP Color LaserJet 5550hdn
- HP Color LaserJet 4700
- HP LaserJet 4350
- HP LaserJet 9000mfp
A quick Q&A ...
- Q: Help! My HP LaserJet says something really nasty! How do I reset the READY message?
- A: Just power cycle the printer; when the printer resumes normal operation you'll see the ever so friendly READY message.



Did you find this post helpful, or at least, interesting?