Can this printing be done in Flash/Java? - java

I would like to know if the following can be done in flash/Java:
I have an ASP.NET web site from which I need to be able to print/send a specific set of instructions to a code-bar printer. Since this can't be done from javascript, I thought maybe a client side app/plugin (Flash, Java) could do it.
Do any of you know if this can be done? where can I find how to do it?
many thanks in advance!

It is possible to print in Java, for a website you could develop a Java applet. There is an official Java website available about printing which includes API documentation and tutorials. The only catch is because of the Java security model the applet needs to be signed.
Here is another link from Java about signing applets. Note that you are able to create your own signature (as opposed to having one from a certificate authority), it will just pop up a warning when the applet loads, which may be ok depending on the audience of your website.

Related

Using NFC in a webapp

I have written a webbased application which handles contacts, orders, and permits to use this company's facilities. We use an ACR122U interfacing with it via a Java Applet and javascript (http://ndefeditor.grundid.de/).
I have come to realize this was a bad idea, as it seems every week Firefox blocks the applet because 1.) it's an applet 2.) it's unsigned 3.) Java needs to be updated
So I'm looking for a better way to interface with the ACR122U connected to each terminal via javascript.
One idea I had was to write a chrome app wrapper for my app, but I don't know if this will give me the access to the ACR122U that I need without using the applet. There's a whole Java library (https://github.com/grundid/nfctools) that is available also.
Looking for any suggestions or anyone else with previous experience.

Alternatives to Java applet or solution to unsigned the applet website connection

I have written an applet that reads data (in the form of string) from some website each 2 seconds, do some processing and then display the results in bar-form (basically display on Swing components). That was working fine when I launched it from netbeans. Once I did it out-side netbeans, all hell break loose because of the signed and un-signed problems, obviously my applet is un-signed.
My question is, what are my other options to do the same process within java ( I am not familiar with the other languages that much) because I have seen people talking about SFX Fx and JSP but I couldnot figure out the mapping from the applet to them. The other thing is: I couldn't find a post that shows how to establish a URL connection from an un-signed applet, are u aware of any?
Regards.
There really is no alternative for cross-site access in an applet. The applet needs to be digitally signed.
A JSP could do it without being digitally signed, but then you'd need to be running Java on the server side (an applet needs Java on the client side).
In case you're wondering. Cross-site access is usually for stealing resource from one site, to reproduce it on another site as if it were the property of the other site. That is why Sun/Oracle decided the applet need to be digitally signed. The user should know that they are accepting an applet that requires full permissions (available only after the user is prompted, and clicks OK) before it will run.

Recording/playback audio on web based page with Java

I've found plenty in javascript etc, and for desktop-based ones in Java, but none for web-based java. Any ideas?
For comprehensive access to the Java Sound API, look to the javax.sound.sampled package.
See the Sound Trail of the Java Tutorial for details on how to use the API.
To record sound, the applet would need to be digitally signed (by you) and trusted (by the end user - when prompted at start-up).
Daniel made a good point about sound in web pages. Users generally hate it. Make sure your applet does not attempt to play any sound until requested by the user. Set the volume to a relatively low one.
I believe you can create an applet, which then is embedded into web page. And applets are capable of playing whatever you want, even without authorisation from the user (as far as I remember, it is allowed by JVM sandbox). Applet class even has dedicated method for this: Applet.newAudioClip .

Printing and saving files in java applets

we have this problem: we want to save files or print from java applet in browser, but this could not be easily implemented, as java applets don't seem to have rights for calling OS services. Is there any way to implement these two functionalities (maybe with server help etc.). What would you suggest?
Thank you in advance
For accessing resources outside the Applet sandbox, you'll need to sign your Applet, and set up the access privilieges at a policy file.
Here you can find a quite complete guide on Applets Security.
Well the solution was very simple :). In Netbeans -> Project properties -> Application/Web Start/{check the self-signed checkbox}. That's it with all certifications
Tomas is right. But probably I can suggest you a workaround. You can implement your print through browser. This does not require additional security permissions and applet might be unsigned.
To call javascript API from applet the applet must have attribute MAYSCRIPT and use netscape.javascript.JSObject. Yes, netscape! The name remained as a monument for this died browser.

Launching a website from within a program, and inputting data to specific fields

Although I've been programming for a few years I've only really dabbled in the web side of things, it's been more application based for computers up until now. I was wondering, in java for example, what library defined function or self defined function I would use to have a program launch a web browser to a certain site? Also as an extension to this how could I have it find a certain field in the website like a search box for instance (if it wasnt the current target of the cursor) and then populate it with a string and submit it to the server? (maybe this is a kind of find by ID scenario?!)
Also, is there a way to control whethere this is visible or not to the user. What I mean is, if I want to do something as a background task whilst the user carries on using the program, I will want the program to be submitting data to a webpage without the whole visual side of things that would interrupt the user?
This may be basic but like I say, I've never tried my hand at it so perhaps if someone could just provide some rough code outlines I'd really appreciate it.
Many thanks
I think Selenium might be what you are looking for.
Selenium allows you to start a Web browser, launch it to a certain website and interact with it. Also, there is a Java API (and a lot of other languages, by the way) allowing you to control the launched browser from a Java application.
There are some tweaking to do, but you can also launch Selenium in background, using a headless Web browser.
as i understand it you want to submit data to a server via the excisting webinterface?
in that case you need to find out how the URL for the request is build and then make a http-call using the corresponding URL
i advice reading this if it involves a POST submit

Categories