aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Reply locked New topic

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

sureshreddy govindu

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 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);
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 3402
Please use UseOneThreadPerQuestion.

We'll continue the discussion here:
I agree. Here's the link:
subject: argox os-2140 barcode printer how to pass barcode values to printers .
Similar Threads
printer not calling through this program..
Printing with 300dpi
how to set up custom page set for printer and select printer for script
Print simple jpeg image using java
Printing Report in Struts2