I am trying to write a Chrome app that would support printing to old printers connected to the computer via the parallel port. I found out that Chrome apps can not use any kind of NPAPI plugins so those are out of the question. The remaining option seems to be NaCl or PPAPI plugin. But does PPAPI or pepper or NaCl (I am not very familiar with any of them and am probably using them in the wrong context) support access to the parallel port? Can a PPAPI plugin be written, which supports parallel port communication? Thanks for your time and efforts.
2 Answers
You can usually write to the parallel port like to a file. (it's a few decades since I did this the last time myself though)
in Linux use /dev/lp0
as file name
see also https://superuser.com/questions/301753/how-do-i-print-directly-to-lpt-port-in-ubuntu
in Windows LPT0
see also
* https://developers.google.com/native-client/dev/devguide/coding/file-io
EDIT
I thought chrome packaged apps are allowed to access the local file system.
If that is limited to a sandboxed area it may not allow access to the parallel port.
Using NaCl seems to support unlimited access to local files, so this will probably work.

- 1
- 1

- 623,577
- 216
- 2,003
- 1,567
-
Are you sure this will work? I'm pretty sure arbitrary file system access is not allowed. See `nacl_dangerous_enable_file_access` – Janus Troelsen Jan 12 '15 at 04:17
Packaged apps have access to the USB ports, along with serial ports. http://developer.chrome.com/apps/api_index If you are writing a javascript app, you might be able to access this functionality without writing a native client app, however if you are writing in C/C++ a subset of these APIs are available using the Pepper APIs.

- 131
- 1
- 4
-
I know there are API's for USB and serial ports. I wasn't asking about those. I was asking about the parallel port specifically. I am sorry but I do not see the relevance in your answer. Thanks for the time and effort, though. – dexter Feb 20 '14 at 23:38
-
The answer is correct and complete. There isn't any parallel-port support, and unfortunately it's extremely unlikely you'll ever see it. The reason USB/serial are there is because modern hardware is still being manufactured that use those interfaces (serial, of course, is frequently virtualized). Your best bet is to investigate native messaging (https://developer.chrome.com/extensions/messaging#native-messaging-host), but it will mean shipping your own parallel-interface proxy written in native code for every host platform you wish to support. – sowbug Feb 21 '14 at 03:53
-
Also, try this: http://www.amazon.com/C2G-16899-IEEE-1284-Parallel-Printer/dp/B000UX21PY/ref=sr_1_1?ie=UTF8&qid=1392954960&sr=8-1 then you can directly use NaClPM's answer. – sowbug Feb 21 '14 at 03:56
-
@sowbug: How can NaCIPM' s answer be correct and complete when it is off topic? I was asking about parallel port support in NaCl and (s)he never once mentioned it in the answer. In fact, Your answer is much better (quote: There isn't any parallel-port support, ...) since it talks about things I actually asked about. Your suggestion about native messaging seems to be the only workable option (NPAPI isn't allowed) if I want to use Chrome Apps but I think that is too complicated a solution just to say I used Chrome Apps in it. If You re right it is time to look for solutions outside Chrome Apps. – dexter Feb 21 '14 at 07:16
-
@sowbug I can't use the cable cause the printer has to work with older apps that possibly can't communicate via USB. Thank you for your help. – dexter Feb 21 '14 at 07:18