This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Displaying barcode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Displaying barcode" Watch "Displaying barcode" New topic
Author

Displaying barcode

Vijay Venkat
Ranch Hand

Joined: Aug 12, 2001
Posts: 52
I have the algorithm for the barcode.
But i dont now how to exactly paint it in panel and then print it.
Say how to draw a rectangle that is exactly one mm in width.
This i have to print exactly how is it possible. Please give me leads if not the exact answer.
I need to know about it. Its very urgent.
Thanks in advance
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Perhaps the Java2D package would make this a bit easier since you can draw lines of various widths. Here's an O'Reilly sample chapter talking about it.
http://www.oreilly.com/catalog/java2d/chapter/ch04.html
For printing, perhaps creating an Image object, then using it's graphics object to draw on might be best. This way you can save the image to disk or print it out (which may provide better resolution). Hope this helps.
Sean
Vijay Venkat
Ranch Hand

Joined: Aug 12, 2001
Posts: 52
Thankyou very much Sean MacLean- Thanks for the lead too.
But the real crux is !!!
My question is to how to print a rectangle or image that is exatly as per the reqquired size.
Now i am able to draw the image.
But for printing i need precision.
I have to draw a rectangle of specified size. Say height 135mm and width=1mm (max tolerance +- 0.024mm)
How do i map it to the printer.
Hope my question is clear.
I want to generated barcodes on labels or paper.
For that case their width and height has to be as per the standards.
How can i do it.
Help needed very badly.
Thanks to everyone.
Have great day
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Displaying barcode
 
Similar Threads
Barcode input
print a barcode from JSP
Bar Code Generation API from Sun
Counting number of files in each folder
Need Help in barcode display