My problem is as follows.
A set of users[lying in the same network and all using windows xp] are using a specific network printer for printing their documents.
Now, whenever someone prints something, I need to check if that file-name starts with a specific code, and if so, I need to insert a row in one of the audit tables.
The problem is, the users can open any document and try to print them using this printer. How can I track that this printer is getting used, when my own piece of code is not invoking it at all?
Is there a way to catch this event of printing on a specific printer, irrespective of any knowledge of the source that fired this event? Is it at all possible to track this using java code?
Waiting eagerly for java gurus to respond. Thanks in advance for your kind co-operation.
Regards,
animark
use some print Server like CUPSD
Related
I am trying to get a CyNetwork[] containing all of the networks open in the Cytoscape network tab. My understanding is that I need a CyNetworkReader to call CyNetworkReader.getNetworks() and to get a CyNetworkReader I need a CyNetworkReaderManager. However, I don't know how to get a CyNetworkReaderManager, nor do I know the proper InputStream or input name to use CyNetworkReaderManager.getReader(). Any help would be much appreciated.
Close. Actually, you would need a CyNetworkReader to read in a new network from disk. If you want to get the list of currently loaded networks, you would need to use the CyNetworkManager.getNetworkSet() method. To get a handle on the CyNetworkManager, you just need to get it from OSGi, so in your CyActivator, you would do something like:
CyNetworkManager cyNetworkManager = getService(CyNetworkManager.class);
That's it.
-- scooter
I want to develop an application in Java which takes data (ex.name of person, Amount) from excel-sheet and print it on cheque. I can able to access data from excel-sheet but don't know how to print that data on cheque. Data must get print on appropriate location on cheque (ex. name should get print where blank space is given for name). please give me a guideline for this. Thank you in advance. I am not native English speaker so kindly ignore my mistakes.
You can use a reporting tool. You can see examples here: http://www.dynamicreports.org/
I would create a PNG image for each record, with a transparent background and data at the right place. Then I would launch the printing of these images .
That sounds hacky and someone might have a better idea.
I'm starting to do anything like this, so I need a little bit of help to start with.
I want to print some data and give it a format to print it as an establishment ticket, so what would be the best way?
Using the java api and create the service by myself?
http://docs.oracle.com/javase/tutorial/2d/printing/index.html
Or does it exist any free library to this purpose?
Maybe better creating a PDF with the data before printing?
I've been messing around with PDFbox API but I don't like it very much.
I don't know what printer will be used so, do ticket printers use a standard size or exists differents ticket sizes?
I also need to show a preview before printing it (I'm using Swing).
There's no need to store the formatted data.
Thanks in advance.
If You decide to generate pdf file and then print it, I propose to use Apache FOP. I always use this library to generate PDF. This library is not easy but offers many options.
Second option - You could generate HTML page and then print it.
From a real live example: we're running a project that prints despatch labels to send a package with a parcel service. The label contains barcodes and other textual information as well as a logo.
Usually a ticket printer understands a special printer control language, i.e. if it's a Zebra printer it understands EPL or ZPL-code. To produce a ticket we simply send the whole control code over a simple socket connection to the printer. The control code itself is created through a template engine (Velocity in our case).
Of course there are different printers for different requirements - it may depend on what actually should be printed. So depending on the printer you may need to create a different set of template to produce your label:
https://en.wikipedia.org/wiki/Printer_control_language
By the way:
Usually the printer comes with software to let you design the layout of the paper label (which makes life really easy). We used this software to create the initial layout. The control code itself contains all commands used to configure the printer (label size, etc - no doubt there are plenty of different formats and sizes, as said: it really depends on the use case).
I am developing an application as a college project. It's (almost) complete, with most features working properly.
The application records visitor information and prints a visitor badge for each visitor.
The visitor enters their information into the system through a user friendly interface, on completion a visitor badge is automatically printed and their details are saved to a database.
This all works great!! We've already gotten our grades and we got top marks, couldn't be happier!!
However, the printer options on the admin screen are quite limited for the label printer.
On the admin screen you can search the database and print the results using the typical print dialogue, or you can save the data to a comma delimited CSV file.
All good! But as the label printer only operates from the front end of the program, where there is no print dialogue available, I need to provide access to the printer options on the admin screen then save them for use later when the label printer is in operation.
At the moment we have the ability to select what printer will be used to print the visitor badges, and we can set and save the page set-up information from the admin page - but I cannot figure out how to access the printer set-up options to provide access to the administrators without using the print dialogue.
Anyone advice would be greatly appreciated.
Maybe i totally got you wrong..:)..Maybe this could help you
Java Print API
when printing with Java, one can select the media tray (within PrintRequestAttributeSet). Then one can pass this setting to a printjob and have one's document printed to the given tray.
My question is now: can I somehow specify that the first page is printed to one tray and the second one to another tray within one print job?
I'm reluctant to creating two separate print jobs, because my usage scenario is a mass-print, of say 1000 documents. Each document has some pages going to tray 1 and some pages going to tray 2.
If I have to create a new print job on each switch of trays, I would end up with several thousands of separate print jobs and I'm afraid of all sorts of print-spooler overruns and system crashes. Thus my preference to somehow sneak those "switches of tray" into one print job.
I'm pretty sure that it can be sone somehow, but didn't succeed so far.
I thought about creating those thousands of PrinterJobs, but having them print to a StreamPrintService (instead of an actual print service), thus capturing the switches of tray along with the actual printing data. Then I was planning to concatenate the results of those single "virtual" prints and send it all to a real printer in one real print job.
However, with java 1.6 there seems to be only one StreamPrintService, which can only output postscript.
So: is there a way to capture the raw, native output from a native printer driver (using java)? Does it seem practical to you to concatenate that output and send it to the printer, in order to solve my problem?
I would be glad, also about comments regarding only parts of the problem..
By adding a "Destination" attribute to one's print attribute set, the print can be redirected to a local file. That file contains the printjob in whatever language the actual printer's driver uses to talk in.
In my case, I ended up with postscript files.
I created two postscript files, each printing from a different tray and then send their concatenation to the printer. And it worked :-) ! I switched of the printer to verify that there is only one printjob and I wrote some numbers on the paper in the those trays. So I guess I can be sure that it's not only wishful thinking ;-).
However, I think I won't pursue this topic in depth, because
I'm not a printing guru and have my doubts that this approach works every case.
For our customer, the whole thing is a nice-to-have at this time, so there won't be a budget to reasearch further on the circumstances under which this little idea works