This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread 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 Building Microservices this week in the Design 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: 4000
    
  18

Please use UseOneThreadPerQuestion.

We'll continue the discussion here: http://www.coderanch.com/t/541573/Streams/java/printer-not-calling-through-program


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
 
Have you checked out Aspose?
 
subject: argox os-2140 barcode printer how to pass barcode values to printers .
 
It's not a secret anymore!