Somebody correct me if I'm wrong, but I think...
 
To print a document directly, you need to use a renderer which implements Printable and Pageable.
 
You can then do something like
 
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPageable(renderer);
        pj.print();
 
after you've used the Driver to process the document.
 
At the moment, the only renderer which seems to comply is the AWTRenderer, which makes some sense, as it is producing a Graphics drawing rather than some external format.
 
What I don't understand is why org.apache.fop.render.PrintRenderer is called PrintRenderer: the role seems to be pretty much reversed, in that the classes which extend it are the ones you couldn't print direct from java (without some plugin) because they're external formats...
 
A warning:
 
a/ The awt renderer is a little ropey just now
b/ my understanding of all this is a little ropey just now

Alistair

-----Original Message-----
From: Gorka Echevarría [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 18, 2001 9: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]
--------------------------------------------
 
 
 

 

Reply via email to