wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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 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);
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 3575

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 .
Similar Threads
Printing Report in Struts2
Print simple jpeg image using java
how to set up custom page set for printer and select printer for script
Printing with 300dpi
printer not calling through this program..