-
Okay Daniel the code you provided:
PHP Code:
$str = explode('|',$str);
for ($i=0;$i<count($str);$i++) {
echo $str[$i]."\n";
}
Works great now is there a way to do using
PHP Code:
printer_draw_text($handle, $specship, 1, 3600);
So that each line that your code generates goes into its own printer_draw_text()
-
Okay i got my last question answered my self. so here is what my final code looks like. Provided for learning purpose.
PHP Code:
<?php
$int_y_pos = 3600;
$int_y_step_small = 100;
$str_value = "Feel free to use the regular|expression we made above on your own site to validate|email addresses, or modify it for your own purposes.";
$handle = printer_open("Brother HL-5150D");
printer_set_option($handle, PRINTER_MODE, text);
printer_set_option($handle, PRINTER_TEXT_ALIGN, PRINTER_TA_LEFT);
printer_start_doc($handle, "Invoice");
printer_start_page($handle);
$str = explode('|',$str_value);
for ($i=0;$i<count($str);$i++) {
$int_y_pos += $int_y_step_small;
printer_draw_text($handle, $str[$i], 1, $int_y_pos);
}
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
?>
This code allows you to take a string and break it up to multiple lines for PHP's print function. In my case (not shown above) every where the code picks up a </p> (generated by TinyMCE) it breaks it into a new printer_draw_text() function for printing straight to a printer (Windows Only).
-