Baker Mail Forwarding System
From ThePlaz.com
In February 2012, I built the Baker House Mail Forwarding System. This system allows desk workers of my MIT dorm to easily print labels for mail forwarding. Baker forwards mail for residents over the summer and for 6 months after residents leave. This system is a component of the Baker Desk system.
Contents |
Previously
Before the mail forwarding system, residents would write their address on a piece of paper when they moved out. All of these papers would then be typed up and a sheet of labels would be printed for each person. These labels would then be stored in a binder alphabetically. Each day when the mail arrived, the desk worker would sort the mail alphabetically and then search through the binder for the pre-printed label. They would then stick the label on the envelope and give the mail back to the post office.
System Design
When residents move out, they log on to the Baker Desk website and provide their new address. Residents can log on at any point in time to update their address. An administrator can also update their address for them. When a letter arrives, the desk worker simply has to type in the person's name. The system then looks up their record, makes sure they still have mail forwarding privileges, and then prints a label on the Dymo printer. The resident is then notified by email so they know to look for the letter in the mail.
Results
The system has dramatically cut the amount of time desk workers spend processing mail forwarding, while making the system more flexible.
System Setup
Printer
We are using the DYMO LabelWriter 450 Turbo label printer. It's actually a pretty good product! It appears to support PostScript pretty well! It even comes with Linux drivers! It is a thermal printer, so you don't need ink or toner. Just don't jam it!
Print Server
We use the Dymo LabelWriter Print Server as print server. This little box has been fairly reliable and is better than using a PC to do this function since there is less to update/maintain. The little box just sits and blinks in the corner.
CUPS
I installed CUPS on the Baker web server and set up the Dymo as a label printer. Make sure to use the right driver/PPD file! Dymo had both a LabelManager 450 and a LabelWriter 450! I wasted an hour trying to print to using the LabelManager driver - which prints very small labels!
Submit Address
I added a page to the Baker website where users can submit their mailing addresses.
Forward Mail
I added a page to the desk worker side of the portal where desk workers can enter a name. The name is then looked up, and the forwarding info is retrieved. If the user is eligible for mail forwarding, we generate a label.
Label Generation
I build a template for the label in Adobe Illustrator. I then saved the AI file as a PDF. I then opened the PDF file in Acrobat and saved the PDF as a PS file. I then uploaded the PS file to the server. On the server, I use sed (find and replace) to replace my template text in the PS file on the fly. I have to calculate the kerning (spacing between letters) manually. I then print the PS file on the web server using lp.
lp -d dymo -o landscape -o MediaType=100mm -o media=Custom.1x3.5in -o PrintDensity=Heavy label.ps
Code
Here is a code snippet for the label creation process.
function print_label($name, $line1, $line2, $line3, $month, $day, $year) { $path = '/var/www/label/'; $month = intval($month); if ($month < 10) { $month = "0".$month; } $day = intval($day); if ($day < 10) { $day = "0".$day; } $year = intval($year); exec('cp '.$path.'mail.ps '.$path.'mail_temp.ps'); exec('sed -i \'s/NameNameName/'.escape_paren($name).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/1 1 1 1 1/'.calc_kerning_title($name).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/Line1Line1Line1/'.escape_paren($line1).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/2 2 2 2 2/'.calc_kerning_body($line1).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/Line2Line2Line2/'.escape_paren($line2).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/3 3 3 3 3/'.calc_kerning_body($line2).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/Line3Line3Line3/'.escape_paren($line3).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/4 4 4 4 4/'.calc_kerning_body($line3).'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/MonthMonthMonth/'.$month.'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/DayDayDay/'.$day.'/\' '.$path.'mail_temp.ps'); exec('sed -i \'s/YearYearYear/'.$year.'/\' '.$path.'mail_temp.ps'); exec('ps2pdf '.$path.'mail_temp.ps '.$path.'mail_temp.pdf'); exec('lp -d dymo -o landscape -o MediaType=100mm -o media=Custom.1x3.5in -o PrintDensity=Heavy '.$path.'mail_temp.pdf', $output); exec('rm '.$path.'mail_temp.ps'); exec('rm '.$path.'mail_temp.pdf');