This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes I/O and Streams and the fly likes argox os-2140  barcode printer how to pass barcode values to printers . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Reply locked New topic
Author

argox os-2140 barcode printer how to pass barcode values to printers .

sureshreddy govindu
Greenhorn

Joined: Jun 08, 2011
Posts: 29

hi, i am using argox os-2140 barcode printer . i don't no how to pass barcode commands through java program. tell me how to access the printer . i am using above program is print the barcode. but it is not work. it's needed. below program is working cannon printer . but it's not working with argox os-2140 barcode printer .
thanks a lot for reply.


import java.awt.PageAttributes;
import java.io.FileInputStream;
import java.io.IOException;

import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.SimpleDoc;
import javax.print.attribute.Attribute;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Copies;
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaSizeName;

public class PrintImage {
static public void main(String args[]) throws Exception {
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet() ;
pras.add(new Copies(1));

PrintService pss[] = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.GIF, pras);
if (pss.length == 0)
throw new RuntimeException("No printer services available.");
PrintService ps = pss[0];
System.out.println("Printing to " + ps);
DocPrintJob job = ps.createPrintJob();


FileInputStream fin = new FileInputStream("C:/bbc.PNG");
Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.PNG, null);
job.print(doc, pras);
fin.close();
}
}
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3615
    
  14

Please use UseOneThreadPerQuestion.

We'll continue the discussion here: http://www.coderanch.com/t/541573/Streams/java/printer-not-calling-through-program
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: argox os-2140 barcode printer how to pass barcode values to printers .