Jul 19
VP Printing Locally using JQuery & CUPS
Printing Locally using JQuery & CUPS
Hi folks.
I recently developed a solution where a user pushes an F-key (F12) and instructions go to a Dymo printer to print shipping and return labels.
http://images.google.com/images?q=dymo+turbowriter&ie=ISO-8859-1&oe=ISO-8859-1&biw=1164&bih=1127&sei=wyTpUe-zM8LhygH_soD4CA
It's pretty neat. Now I realize that when I was developing, the printer was on the same machine as Lasso. So the OS_process goes into the server, not the client user machine where the printer will be set up. My oversight. Ya it's funny until you realize you still need a solution.
Anyway, I thought I'd ask the list to see if anybody knows how to print locally. I'm up for any options. Please accept my gratitude in advance.
In the meantime, this is how I operate the system currently. It's a slick solution, but the instructions are taken up by the server, not the client.
- I have a session where two svars are the mailing address and the local address
- I use JQuery AJAX to bring in the mailing address when F12 is pressed, and the return address when F13 is pressed. F12 marks the record as "shipped".
<head>
<script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
</head>
<script language="Javascript" type="text/javascript">
$(document).keydown(function(e){
if (e.keyCode == 122) {
$('#target1').load('printlabel.lasso');
// alert('label');
return false;
}
});
$(document).keydown(function(e){
if (e.keyCode == 123) {
$('#target2').load('printReturnLabel.lasso');
// alert('return');
return false;
}
});
var('returnLabel') = '123 Mystreet
Torontonia, Ontaria
Canadania M4M 2Y3';
var('statement') = '-d DYMO -o media=Custom.28x89mm -o orientation-requested=5';
$statement = $statement->split(' ');
if(true);
output_none;
inline(-username='moose', -password='moosehair');
log_warning('inside print label');
var('os') = os_process( '/usr/bin/lp', $statement );
$os->write( $returnLabel );
$os->closeWrite( );
$os->read( );
$os->close( );
/inline;
/output_none;
/if;
var('d') = date;
$d = $d->format('%-h:%M %p');
'Return printed at ' + $d + '<br>';
Cheers
_____________
Rich in Toronto @ VP
#############################################################
Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Jul 19
Marc Vos Re: Printing Locally using JQuery & CUPS
Jul 19, 2013; 13:57
Marc Vos
Re: Printing Locally using JQuery & CUPS
Jul 19
Lubos Voros Re: Printing Locally using JQuery & CUPS
Jul 19, 2013; 13:59
Lubos Voros
Re: Printing Locally using JQuery & CUPS
Jul 19
VP Re: Printing Locally using JQuery & CUPS
Re: Printing Locally using JQuery & CUPS
Jul 19
VP Re: Printing Locally using JQuery & CUPS
Re: Printing Locally using JQuery & CUPS
Jul 19
VP Re: Printing Locally using JQuery & CUPS
Re: Printing Locally using JQuery & CUPS
Jul 19
Jolle Carlestam Re: Printing Locally using JQuery & CUPS
Jul 19, 2013; 12:14
Jolle Carlestam
Re: Printing Locally using JQuery & CUPS
Jul 19
Jim de Zwart Re: Printing Locally using JQuery & CUPS
Jul 19, 2013; 11:21
Jim de Zwart
Re: Printing Locally using JQuery & CUPS
Jul 19
VP Re: Printing Locally using JQuery & CUPS
Re: Printing Locally using JQuery & CUPS