Send data to Com port from a web page - serial-port

I'm new to web development so please, could you help me to understand if I'm working in the right direction?
There will be a webpage intended for our customers (not intranet) from where they can print labels. Some of the larger customers will have special label printers where configuration and printing using COM-port is the only acceptable option. Basically we have very limited knowledge and control over their environment.
The web-page itself will be a pretty simple html-page or more complex AJAX.
After the customer inputs all the data and happens to chose this type of printing we have following tasks:
1) get data about the printers on the customer's system installed to a comport and if possible get printer settings (like paper size and orientation). Ideally would like to be able to adjust the settings, but if it is a pain can just put into requirements that your printer must be installed to COM1 and configured correctly.
2) send commands and read answers and send PCL code to the selected com port
As I understand I'll need to install something on the customer's machine to be able to talk to com port and get any settings. Just HTML+Javascript are not capable of doing that. Right?
I found RXTX library which seems to communicate to com port on most platforms. Can it be called from JavaScript or I still need to do a Java plugin? Are there technologies other than Java plugin that would solve the task?
The web-page will be used in different environment - platforms and web-browsers. We would like to minimize the number of customized solutions. Will Java allow us to do the same plugin for all environments with minimal customization?
If we require the user to install a plugin will the user be prompted with our credentials to confirm the installation? Will our web-site require higher trust settings?
Thanks for you help!

Well, I've had to do this in the past. Here is what I did and the circumstances
1) I knew that our customers were in a windows environment so I wrote win32 software to handle the printing.
2) I created a file format to be read by the win32 software that allowed me to specify print parameters and the label data. XML works ok for things like this.
3) My web app created a file in the format used by the win32 software and returned it to the user when they clicked on the "Print Labels" button. The file extension on the file returned was registered by the installer of the win32 software. That means when their browser looked for a default app handler for that file, it found my win32 software.
Bottom line is that the browser is handing off the printer communications to a native application instead of talking directly to the printer.
Obviously you need to be able to dictate your end user's are using a windows machine (or mac or whatever you can write native code). Associating a file extension with my program and returning that file to the user was the key to making the process work for me.
Whether your native code sends pcl directly to the printer or translates into a print api (like the win32 api as mine does) is another consideration.
Another approach you could consider is instead of sending PCL codes, you could create a PDF of the document. Format the document to the size and orientation of the label printer. The user will still have to hit the print button, but that might work. I have done this for printing to bar code printers and it works fine. Sometimes getting the margin and orientation correct is a little tricky, but that can be figured out.

Related

Programmatically access files in a device showing up in 'This PC'

I am on Windows 10. I want to write a function (in R) to copy the files stored in a camera (actually in the SD of the camera, but I cannot just read the memory card in the PC), to a different storage unit (say, the pc or an external HDD).
The camera is connected to the PC via an USB cable.
The problem I am facing is that, when opening the File Explorer, the camera is showing up as a link under "This PC" with no letter to indicate the drive (e.g., 'G:/').
While I can see the files using the file explorer window, I cannot find a way to get to those file from a cli type of interface (e.g., the command prompt, or the R console).
Googling, I found that 'This PC' is not a folder but rather a link to something in the registry called CLSID for which the identifier should be {20D04FE0-3AEA-1069-A2D8-08002B30309D}. However this is very confusing to me and I cannot figure out how to use this information.
Is there a way to do it? And if so: how?
Please consider I do not know much of commands from prompt (way better off in R).
A CLSID is just a GUID. My computer is a implementation of IShellFolder.
My Computer is part of the shell namespace. Several entries in the shell namespace are virtual (Control panel, scheduled tasks etc.) and cannot be accessed with low-level file functions nor cmd.exe.
While it would be possible to develop a tool that does something like shellcopy Computer\MyCamera\*.jpg x:\backup, I'm not aware of any existing tools that do this. You might have to code it yourself.
In the old days you would call SHGetDesktopFolder to get the root and then use the returned IShellFolder to navigate but these days it is simpler to use IShellItem instead.
To do this it is crucial to understand how IShellFolder and PIDLs work. See Introduction to the Shell Namespace for more information...

Creating a cross-platform custom virtual printer in Qt or any other IDE

I've searched a lot on this topic but I keep getting more and more confused.
I want to create a cross-platform application (using Qt with C++, for example) that once installed on either MAC or WIN, it will present itself to the system as a virtual printer. So if you hit Ctrl-P on any document, my printer will also be present in the printers list.
My printer will call custom code to extract the data received, create a PDF file, and upload it to some server via FTP.
I looked at "Printing with Qt" documentation here http://qt-project.org/doc/qt-4.8/printing.html and also some existing threads suggesting I need to write a Print Driver for MAC(using CUPS) and another one for WIN (using WDK).
I'm just afraid to start in the wrong direction and just waist lots of time ... so anything that points me to the right direction is useful.
Any ideas are welcome !
Thanks

RadEditor ExportToPDF not generating PDF in client's environment

We are using the Telerik RadEditor control, specifically for it's ability to render a PDF via the ExportToPDF() method on the control. We find that this works great in our development and test environments but fails as soon as we get to our client's environment. What I mean by fails is that typically when you execute the ExportToPDF() method, a dialog box pops up with the name of the PDF file, it's size, and whether you want to open it or save it. In our client's environment that dialog window appears, but the file size does not appear. If you save the file, it's a blank document. The machines / environments are equal in their setup (IIS 6 on Windows server 2003). The only exception is that our client's machine is in a secure environment with no access to the internet.
We are loading form letters into the control and then creating the PDF once the user clicks a button, so I don't think this is being caused by bad data / invalid characters causing the PDF not to generate.
My questions are: does anyone have experience running the ExportToPDF() command in an environment with no access to the internet? Could this be a permissions issue? I can't seem to find documentation on whether the ExportToPDF() functionality uses a temporary directory to write the PDF out to while it's rendering. It may be as simple as that, but I'm having a hard time researching this issue.
I've also put a try / catch block around the ExportToPDF() method and I know it's not throwing any errors.
We are running an older version of RadEditor - 2009.3.1208 - it runs in a large application with other Telerik tools so upgrading the entire RadControl suite is not trivial (b/c of testing, etc) and is taking some time.
Any suggestions on what to try next / has anyone encountered anything like this with this control?
Thanks for your help in advance!
Richard
I doubt that the export functionality needs an active internet connection. Most likely something in your secured environment is blocking silently the export and it does not simply happen. My recommendation is to check the permissions/processes you have on the user machine and test the same outside of the local environment to compare the results.

What is the best tool to make a CD-ROM Demo Application?

I have to make an application that will do the following:
Open a video file embedded in the application
Open some pdf files, preferably embedded in the application, but if it will have to open externally, it's no problem.
Work in fullscreen on the user computer, with a minimum resolution of 1024x768. I'm thinking about a resolution of 1024x768, centered on a black background.
I was thinking of using Flash, but I don't have much experience, so if there is another easier IDE that creates a Flash application, I would prefer that.
So, if anyone knows any Flash component to do this, I'll be very thankful.
Creating a Flash CDROM takes a little bit of care, but from my experience it's well worth it. From your requirements, the Flash IDE is well up to the task. The common requirements are as follows:
Windows / Mac platform
Flash Projector file
Autorun file (For the Windows platform)
Net access or all local
If your client is happy with creating the CDROM just for Windows, there will be very few dramas - but if they want to create a Mac-friendly version, you can do that too and I will explain afterwards.
Your Flash should preferably be an .exe projector file - the reason for this is so that the Windows user can open your app without downloading a Flash player (If the client wants a CDROM, they probably have limited net access, so this is a good thing!)
Within Flash, you can perform all your standard fs commands including full-screen.
You will likely need an Autorun file so that the user sees your application as soon as you put in the CDROM - simply create a file named 'autorun.inf' in notepad and enter the following:
[autorun]
open=yourProjector.exe
Where 'yourProjector.exe' is the name and path of your projector file.
It sounds like you're going to embed your videos and content in the CDROM - this is usually the ideal case, since your client won't receive annoying security messages, but this can also be a bad thing if you want to correct your content later (spotting errors after a thousand CDROMS have been distributed can be a PAIN).
You can serve some of your content online to avoid this, but it would give your user some ugly messages, so as long as you triple-check your content and embed everything, it would be the best scenario.
Now for a Mac, Apple has done away with autorun features years ago - there is a way to turn it on through Quicktime, but this is off by default for almost all Mac users, and turning it on is not recommended because it makes the Mac vulnerable to the 'Hong Kong Virus', one of the few Mac viruses around.
You can make your CDROM mac-friendly by creating a Mac Projector and adding instructions for how to use it by changing the background image of the CDROM window. I haven't had to do it before, but I hear that it's not too difficult.
You can use the Flash Projector. Here is a tutorial to get you started. Now, you won't be able to embed the PDF files but you can open them easily enough using fscommand("exec","foo.pdf")
You can create an Adobe AIR Application; however it won't run off the CD ROM; it'll need to be installed locally.
If creating a projector from Flash Pro doesn't work; look at a tool like Janus or Zinc

How does Adobe CONNECTNOW load and run acaddin?

I am looking for options to download, Install and run a custom plugin/add-on(an exe or an installer) from my Flash Movie similar to how the connectnow does that?
When we initiate the screen sharing for the first time, connectnow prompts us for mandatory add-in by showing the message "To use this application, you need the Adobe ConnectNow Add-in.Would you like to install it now?". Once we agree, it downloads and installs acaddin.exe at the location %USERPROFILE%\Application Data\Macromedia\Flash Player\www.macromedia.com\bin\acaddin on our local machine. Then automatically launches the acaddin.exe and allows the user to close the browser window from where the acaddin.exe was launched.
From the next time onwards, when we login to connectnow, it launches the exe directly.
In this context:
If I were to load my own exe/add-in from flash, How can I acheive that?
How does connectnow application/flash determine whether an add-in was already installed or not?
Connect, and I assume ConnectNow, use hidden, undocumented, private APIs for much of their functionality.
You will not be able to do this.
The best you can hope for is to pass the location of your executable to the browser as a local URL and let the browser handle it. I assume in most cases the browser will reject its' execution. Can you imagine the potential for abuse of such a feature?
Instead of using a browser based app, you may want to investigate using AIR and Native Process.

Resources