Java
--
Questions
--
Followers
Top Experts
I have to create a class that will print out a document that has a barcode (graphic) in it. This document will be created in the code (don't know which type of object yet) and does not come from the HD (maybe this makes a difference, i don't know).
I've been reading about different ways to acheive this and found that there are many packages that offer printing possibilities.
My question is, what's the main difference between JAVA.AWT.PRINT and JAVAX.PRINT ? Which one would be best ?
Thanks
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Is the PrintableDocument interface from the com.davidflanagan.examples






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
where did you get the info on the bar code stuff, which bar code is it? I have a client in which I had to use a third party software package for bar coding . . . I couldn't find the open standards, except for the really simple barcodes . . .
If you want to print without user intervention and send the stuff to a chosen printer directly, you can bypass the whole print dialog with code similar to the following
Cheshire2UpPrintableDocume
PrintService[] services = PrintServiceLookup.lookupP
/*
 * I have a client properties thing where I keep a default printer stored, and then get the correct print service this way
 */
String dpName = ClientProperties.getString
PrintService defaultPrintService = null;
if (dpName == null) {
  // tell client no dp printer chosen
  return;
} else {
  for (int i = 0; i < services.length; i++) {
    if (serivces[i].getName().equ
      defaultPrinterService = services[i];
  }
}
if (defaultPrinterService == null) {
  // warn user could not find default printer -maybe disconnected ? or name changed? have them rechoose
  return;
}
try {
  cheshDoc.print(defaultPrin
} catch (Exception e) {
  // handle print exception
}
The barcode stuff comes from a third party package (ww.java4less.com) that our client gave us for developing their solution. Usually it is distributed as a package but they got the source code and in it is says that it can be modified for our needs. There are many standards included.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Java
--
Questions
--
Followers
Top Experts
Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.