Best method for a webpage to access a mac's peripherals?
I'm building a web-based application that can use ActiveX Controls to print to a Thermal Label Printer (specific to shipping labels) in Windows environments, but I am racking my brain to figure out what the best method would be for OSX. Obviously ActiveX doesn't wo开发者_JAVA技巧rk on macs...
Any ideas about where to start looking? A flash movie? A firefox add-on? My fingers are tired of googling.
There's no way a vanilla web language will allow you to control peripherals from a webpage under Mac OS.
If you really really need to call that from a webpage and can't afford to make a real application, your best go under Safari would be to build a plugin to use Objective-C from Javascript, and do the heavy-duty work from within your plugin. A similar solution probably exists in Firefox.
Also, as I understand it, your program runs on the client with the printer attached. You could write a server-side script and install it on the Macs, and then have your webpage drive it to do the printing.
My first choice to solve this problem quickly would be to use an enterprise label print server like Loftware or Bartender. But, like you said, they are expensive and you are planning on reselling your product.
My second choice would be to scrap the activex control and build a simple print server. There is no standard control language in the label printer world but if you are going to standardize on a certain class of Zebra printer you would only need to implement one driver at first. I have only ever done this for Datamax printers but I'm sure the process for Zebra printers is similar.
The server takes your label data as input (pallet ID, ship to address, etc), inserts that data into a template (painstakingly crafted in the text based printer control language) and then this label file is sent to the appropriate printer.
My third choice would be the browser based solution you are looking for. IT departments hate that stuff.
You can create an NPAPI plug-in, which will work in Safari, Firefox and other Mac web browsers. You'll need to have the user install the plug-in on their system before it can be used, there's no way to install it automatically.
Can't you just use the JavaScript printing API?
精彩评论