Jump to content

Label printing works on linux but not windows


danh123

Recommended Posts

Hello, I currently have a php inventory program running on a nitix server (linux) but I'm trying to move it all over to a windows 7 pro machine running wamp. I got pretty everything else to work fine but for the label printing. I have already enabled lpr. This works on linux:

function label_print($label)

{

	$Printer = ics_select('Employee, Printer', 'Address',

		"EmployeeId=$_SESSION[ICS_UserId] and LabelPrinter=PrinterId");

	$pipe = popen("rlpr -H$Printer[Address]", "w");

	fwrite($pipe, $label);

	pclose($pipe);

}

How do I get this to work on windows or is it not possible and if so, what are my options?

 

Thanks!

Dan

Link to comment
Share on other sites

Please bare with me here. What I know about php is self taught and very basic. I didn't write the code myself but I just tweak the code where I can and when needed. The mysql database is called ics. There is a table called Printer which stores all the label printers info (unique id, name and ip address of every eltron/zebra printer attached to a print server). Each employee that prints labels selects the label printer they want to print to and the printer unique id is stored in the Employee table.

 

I'm not getting any errors. I get the label printed response but the label just doesn't print. By my understanding, rlpr is not a recognized statement by windows?

 

Here is the code from each file that has to do with the labels.

 

stockline.php

require 'ics.php';

require 'html.php';

require 'label.inc';
else if ( $_GET['print_label'] )

{

	label_print(label_part($_GET['StockId']));

	html_status("Printed Label for Control #$_GET[StockId]");

	$PartNumber = $_SESSION['ICS_PartNumber'];

html.php

// html_button() generates a "button" as a small HTML table.
function html_button($url, $label)
{
?>
	<table border="1" cellspacing="0" cellpadding="3"><tr class="menu">
	<th><a class="menu" href="<?php echo $url; ?>"><?php echo $label; ?></a></th>
	</tr></table>
<?php
}


?>

label.inc

/*

					label.inc

This file contains four label template functions:

	label_part($StockId),

	label_receiving($StockId, $Copies),

	label_shipping_address($SalesOrderId, $InvoiceId),

	label_shipping_part($SalesOrderId, $SOItemId, $qty)

and one helper function:

	label_print($label)

*/





function label_print($label)

{

	$Printer = ics_select('Employee, Printer', 'Address',

		"EmployeeId=$_SESSION[ICS_UserId] and LabelPrinter=PrinterId");

	$pipe = popen("rlpr -H$Printer[Address]", "w");

	fwrite($pipe, $label);

	pclose($pipe);

}

below in this file is the code that constructs the label with the information from mysql but I don't think any of that is the issue because it works fine on linux.

Link to comment
Share on other sites

Assuming label_part() returns a file resource, the only problem I can guess is that you don't have rlpr installed on the windows machine. That certainly isn't a native function.

 

Windows DOES have the native function, print:

 

Prints a text file.

 

PRINT [/D:device] [[drive:][path]filename[...]]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.