This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Sorry for not explaining the entire situation.
Actually I'm developing an asset management solution using struts, hibernate, MySQL etc.
The requirement is to attach barcodes to every asset. I searched on google and found barcode4j is being used by many developers.
Now I've used this library to generate barcodes and save the images in jpeg format.
Now I need to print the images directly to my thermal printer i.e. TSC-TTP-244-Plus. Someone with .NET experience suggested me to send .PRN files to the thermal printer but I couldn't find any class in barcode4j for doing the same.
If I right click the JPEG image and use photo printing wizard the image prints just fine (although with little alignment problems but that can be taken care of) but I'm unable to do the same using java.
I also tried the below code but it prints an extremely small image and it spans over 5-6 ribbon labels.
Barcode Thermal printer resolution is : 203 dpi
Joined: Jul 08, 2010
I've found the solution !
Joined: Oct 13, 2005
. . . and what was the solution?
Joined: Jul 08, 2010
There was a mistake in my process....
There is no need to print image on the barcode labels....
since the resolution of my thermal printer is 203 dpi...the images will not come properly...
Now, I used the Software CD that came with my thermal printer to create a customized label with Header, footer and the barcode...
Then I crated the PRN file by checking 'print to file' option....
After that I used the PRN file as a template and wrote code for creating prn file using my java application....
I created a separate class for this purpose . In this I used a StringBuilder variable and stored the contents of the PRN file...and used String variables for label and text fields....
Then I used the command COPY /B <prn-file path> <printer network path> to print the labels...
This command is working fine from command prompt....
But I'm having problems in executing the same command with RunTime.getRunTime.exec() method...
java.io.IOException: Cannot run program "COPY": CreateProcess error=2, The system cannot find the file specified
I'm still finding a solution to run this command using java....