I had problems getting printer to work. I was using PHP 4., 5. is easier.
Code which I have running is:
//select printer, "" for default printer
$handle = printer_open("printer name");
printer_set_option($handle, PRINTER_MODE, "text");
//set paper size: this is for labels, see PHP Manual for set options
printer_set_option($handle, PRINTER_PAPER_FORMAT, PRINTER_FORMAT_CUSTOM);
printer_set_option($handle, PRINTER_PAPER_LENGTH, 100);
printer_set_option($handle, PRINTER_PAPER_WIDTH, 75);
//Set position on page
printer_set_option($handle, PRINTER_TEXT_ALIGN, PRINTER_TA_LEFT);
printer_set_option($handle, PRINTER_TEXT_ALIGN, PRINTER_TA_TOP);
//Begin
printer_start_doc($handle);
printer_start_page($handle);
//Set font
$font=printer_create_font ("Arial",20, 10, PRINTER_FW_NORMAL, false, false, false, 0);
printer_select_font($handle, $font);
//This works in PHP 4.*: check PHP manual for details of printer_write() which does not!
printer_draw_text($handle, $atext[$y], 5, $y*30);
//finish
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);