Ank
Ank

Reputation: 6270

Printing barcodes using java library withing PHP

I have a html button linked to php page. The php page calls a jar file which has to print barcodes on the barcode printer on the server (the default and the only network printer installed). I'm calling it as within my php.

$out = system("java -jar C:\\wamp\\bprint\\bprint.jar ABC1234");

The jar works fine in the command line (and prints the barcodes) but it doesn't print anything within my php page. I know the jar is being called in my php page because a System.Out.Println(); within my jar executes fine. Other executable are working too within system()

I am running WAMP on Windows XP and Apache is running as a Admin user.

My question is, it the printing part being blocked by PHP or Java or Apache. How should I overcome it?

Thanks

Upvotes: 1

Views: 220

Answers (1)

jli
jli

Reputation: 6623

system only returns the last line of stdout. Try using exec with the array &$output parameter.

$out = array();
exec("java -jar C:\\wamp\\bprint\\bprint.jar ABC1234", $out);
var_dump($out);

Upvotes: 1

Related Questions