Reputation: 41
We have to following situation, for one of our clients we are looking for a solution. He has build an PHP script that generates a label with some info and barcodes on it, so the workflow is as discribed : User put in some data ( some is data is pulled from the database, some not )
When the user clicks on print label, a windows opens and the label is generated. So now the code ( i guess javascript can do the job ) must do the work. The client wants that when the user clicks on ok ( or print label ) the label will be printed and the window will close without any interuption from a user.
Possible solution : http://dymodevelopers.wordpress.com/2010/06/02/dymo-label-framework-javascript-library-samples-print-a-label/
So in fact :
Thanks for the help ;)
Upvotes: 4
Views: 23711
Reputation: 11
We just use an FTP (used to use windows, now use whats built into cold fusion, but any would do) and you send the zebra printer the definition of your barcode to the machine that way... anything that can open up such a channel and send the code to the printer will work.. so if you want to do it with javascript see how fireftp does it... then use that... or you can send info in ZPLII coding... that tells it how to print.
Upvotes: 1
Reputation: 483
Never used it myself but Seagull Scientific' BarTender seems like a good solution for direct printing of barcodes. It includes embedded drivers for working with databases such as Oracle, MS SQL, and .NET platform and offers Commander for printing from PHP web apps. Tutorial for printing through PHP apps here http://cases.azoft.com/bartender-print-server/
Upvotes: -2
Reputation: 172
Since the link you posted talks about driver requirements, I assume you have a fair amount of control over the machine's software? If that's the case and you can use Firefox, then an add-on called JS Print Setup may work.
It basically gives webpages the ability to print directly to a printer on the user's computer without a print dialog.
I assume it would print a label fine as long as the right size is provided, but I haven't tested that. I did test it when a printer wasn't connected and it did send it to that printer's queue, so definitely tells the system to print the file.
Here is a code sample from the documentation: (It appears that it lets you set margins and everything as well.)
<script>
// set portrait orientation
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', 15);
jsPrintSetup.setOption('marginBottom', 15);
jsPrintSetup.setOption('marginLeft', 20);
jsPrintSetup.setOption('marginRight', 10);
// set page header
jsPrintSetup.setOption('headerStrLeft', 'My custom header');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '&PT');
// set empty page footer
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
// clears user preferences always silent print value
// to enable using 'printSilent' option
jsPrintSetup.clearSilentPrint();
// Suppress print dialog (for this context only)
jsPrintSetup.setOption('printSilent', 1);
// Do Print
// When print is submitted it is executed asynchronous and
// script flow continues after print independently of completetion of print process!
jsPrintSetup.print();
// next commands
</script>
The add-on can be found here on Mozilla's add-on site:
https://addons.mozilla.org/en-US/firefox/addon/js-print-setup/
Upvotes: 0
Reputation: 3288
I do exactly this but due to the limitations of web based stuff cannot control the windows print interface without either firing a java or an activex based sub app I have had to have the web browsers set to print to the dymo printers.
Now I enforce the usage of firefox which means I have a custom install bundle of firefox that sets the margins to zero, turns off headers and footers, selects the right printer and paper and landscape etc (I only did a custom bundle because I had 100+ pc's to configure if its only a few its a 60 second change job to do it manually). The advantage of enforcing firefox is that FF allows you to select and set as the default printer a different printer to the system default. So in my case ff is set for dymo's the system printer is set as the kyocera's so nothing gets lost/set etc outside of firefox.
As for generating the barcode I just create a basecode as a jpg on the fly display the jpg in a new popup window and use a little javascript to automatically popup the print box so all the user has to do is click ok. Its impossible to do this without user input!
Unfortunately there's no easy way so close the window as there's no return event trap from the system print spooler/drivers back into the web browsers (they're sandboxed from each other for obvious reasons!) so the best you can do is implement a timed close after xxx seconds.
Short of it though is there's no easy way to do this with no user input and without making a few compromises. Now if cash and time is of no issue to you I do have a proper way of doing it fully automated etc but its a big job
Upvotes: 2