Skip to main content

Printer Dialog Problem

1 reply [Last post]

Hi Forum,

I�m having some problems with the printer dialog,
i need to get the printer�s sharing name from the
printer dialog to print to a FileOutputStream, but idon�t know how to get the property. I hope someone can help me out. here is my peace of code.

StringBuffer yourText = new StringBuffer();

yourText.append(?TEXTO ? TEXTO - TEXTO?);

byte[] bytes = yourText.toString().getBytes();

PrinterJob pjob = PrinterJob.getPrinterJob();



FileOutputStream outputStream = new FileOutputStream("\\\\Server\\epson");



-->> pjob.getPrintService().getName() ->> this method will get the printer�s name, but i need the printer�s sharing name, and i can�t find it, i�ve tryed to use the PrinterJob to print the text, but it�s printing in graphical mode, and i need to print pure text to the printer, if there is another way to do so, please help me.

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-10

Have a look at the javax.print package. You want to use a DocFlavor of INPUT_STREAM or READER.