Difference between revisions of "Baker Mail Forwarding System"

From ThePlaz.com

Jump to: navigation, search
(update)
(fix headings)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
{{Draft}}
+
[[Image:Baker Mail System Testing.JPG|thumb|The system under testing]]
 +
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.
  
In February 2012, I built the Baker Summer Mail System.
+
==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.
  
==Server==
+
==System Design==
I added a page where users can submit their mailing addresses to our existing dorm desk system.
+
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.
  
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, I generate a label.
+
===Results===
 +
The system has dramatically cut the amount of time desk workers spend processing mail forwarding, while making the system more flexible.
  
==Label Generation==
+
==System Setup==
I build a template for the label in Adobe IllustratorI 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 my server. On the server, I use Find and Replace to replace my template text in the PS file on the flyI then print the PS file on the web server.
+
===Printer===
 +
We are using the [http://www.amazon.com/gp/product/B0027JIIKQ/ref=oh_o02_s00_i00_details DYMO LabelWriter 450 Turbo] label printerIt'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 tonerJust don't jam it! 
  
lp -d dymo -o landscape -o MediaType=100mm -o media=Custom.1x3.5in  -o PrintDensity=Heavy label.ps
+
===Print Server===
 +
We use the [http://www.amazon.com/gp/product/B001PKUUHM/ref=oh_o00_s00_i00_details 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==
+
===CUPS===
I installed CUPS on the Baker web server.  I added myself to the lpadmin group so I can administer the server from the web.  I use elinks to navigate the CUPS website, because it is only available to the localhost, and I didn't want to muck with firewalls.  Looking back I could have probably administered the printer using the command line.  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!
+
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!
  
==Print Server==
+
===Submit Address===
For testing purposes, I hooked up the Dymo to my Windows Desktop and shared the printer using Windows File and Printer Sharing.  You can connect to the printer using LPD (after turning on the LPD print server in "Change Windows Features")
+
[[File:Baker Mail Forwarding Website.png|thumb|Address Submission Website]]
lpd://18.245.6.XX/dymo
+
I added a page to the Baker website where users can submit their mailing addresses.
  
I have ordered the [http://www.amazon.com/gp/product/B001PKUUHM/ref=oh_o00_s00_i00_details LabelWriter Print Server] to use as a permanent print serverThis should be more reliable for full time usage, rather than using the desk computer or another full machine.
+
===Forward Mail===
 +
[[File:Baker Mail Forwarding Website Print Label.png|thumb|Desk Worker Label Print Page]]
 +
I added a page to the desk worker side of the portal where desk workers can enter a nameThe name is then looked up, and the forwarding info is retrieved.  If the user is eligible for mail forwarding, we generate a label.
  
==Printer==
+
===Label Generation===
I am using the [http://www.amazon.com/gp/product/B0027JIIKQ/ref=oh_o02_s00_i00_details DYMO LabelWriter 450 Turbo] label printerIt's actually a pretty good product! It appears to support PostScript pretty well!  It is a thermal printer, so you don't need ink or tonerJust don't jam it!  If you do, you can remove the front coverThe labels often wind up around the roller. I use a Xacto knife to cut the wound up labels straight across.  I then hit the "advance" button and the pieces come right out.
+
[[File:Baker Mail Label Template.png|thumb|A version of the template of the label]]
 +
I build a template for the label in Adobe IllustratorI then saved the AI file as a PDF. I then opened the PDF file in Acrobat and saved the PDF as a PS fileI then uploaded the PS file to the serverOn 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.
 +
<source lang="php">
 +
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');
 +
</source>
  
[[Category:Tech]][[Category:Baker]]
+
[[Category:Tech]][[Category:Baker House]]

Latest revision as of 19:43, 20 October 2012

The system under testing

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

Address Submission Website

I added a page to the Baker website where users can submit their mailing addresses.

Forward Mail

Desk Worker Label Print Page

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

A version of the template of the label

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');