> P.S: DON'T USE BACKSLASHES - PLEASE!!! It's a windows thing!!! Use slashes
> in filenames for java !! Well, were not dealing with files here. \\ntsrv_200\prn1 is a UNC (http://webopedia.com/TERM/U/UNC.html). The code snippet below used to work (on older versions of FOP). /** * Print the PCL directly. * (Just to show it works.) * (I wouldn't use it for real.) * * @param driver <code>org.apache.fop.apps.Driver</code> */ public void print( Driver driver ) { if( driver == null ) return; // Select a printer. String printer = (String)JOptionPane.showInputDialog( null, "Specify a printer", "Printer Dialog", JOptionPane.QUESTION_MESSAGE, null, null, "\\\\HASRV1\\HHA_LJ5M_01" ); if( printer == null ) return; printer = printer.trim(); if( "".equals(printer)) return; // Create an output stream to the printer. OutputStream stream = null; try { stream = new FileOutputStream(printer); } catch( FileNotFoundException fnfe ) { System.err.println("PclTranslator.print(): FileNotFoundException"); } if( stream == null ) { System.err.println("PclTranslator.print(): cannot stream to "+printer); return; } // Do output. driver.setOutputStream(stream); try { driver.render(); stream.close(); } catch( FOPException fe ) { fe.printStackTrace(); return; } catch( IOException ioe ) { System.err.println("PclTranslator.print(): IOException"); return; } } // end print() Jens Thieler -----Urspr�ngliche Nachricht----- Von: Beer, Christian [mailto:[EMAIL PROTECTED]] Gesendet am: Donnerstag, 13. Dezember 2001 10:50 An: '[EMAIL PROTECTED]' Betreff: AW: Send a document directly to a printer I think it is not that easy to open a "file" connection to a printer like it was in dos times (I don't know if it could be done in windows). I think you can't open an OutputStream to a printer. Well sorry enough I don't know how to send a file to a printer. Didn't have to do it till now. Sorry. Christian P.S: DON'T USE BACKSLASHES - PLEASE!!! It's a windows thing!!! Use slashes in filenames for java !! -----Urspr�ngliche Nachricht----- Von: Thieler Jens [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 13. Dezember 2001 10:42 An: '[EMAIL PROTECTED]' Betreff: AW: Send a document directly to a printer And do try backslahes. -----Urspr�ngliche Nachricht----- Von: Dvor�k Zdenek [mailto:[EMAIL PROTECTED]] Gesendet am: Donnerstag, 13. Dezember 2001 10:40 An: '[EMAIL PROTECTED]' Betreff: RE: Send a document directly to a printer Hi Echevarr�a, this looks like the program fails on FileOutputStream out = new FileOutputStream(printer); from API: <file:///C:/Data/zdv/lze%20smazat/jdk1.2.2/docs/api/java/io/FileNotFoundExce ption.html> FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason Try first to save the output to a regular file on the disk in order to eliminate the FOP fault. regards Zdenek -----Original Message----- From: Gorka Echevarr�a [mailto:[EMAIL PROTECTED]] Sent: Sunday, November 18, 2001 10:19 AM To: Lista-FOP Subject: Send a document directly to a printer Hi, Can anybody say me how can I send a document directly to a printer? I have tried the following code to render the document to a printer using "Driver.RENDER_PCL", but it doesn�t work (i get the exception "file.io.FileNotFoundException") String printer ="////ntsrv_200//prn1"; FileOutputStream out = new FileOutputStream(printer); Driver driver = new Driver(input.getInputSource(),out); driver.setRenderer(Driver.RENDER_PCL); driver.run(); out.close(); Thanks in advance -------------------------------------------- Gorka Echevarr�a V�lez BILBOM�TICA, S.A. [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
