Title: RE: Print PDF !!!
Your example prints a GIF file. Have you tried this with a PDF? I assume you are using Java 1.5?
-----Original Message-----
From: Rob Stote [mailto:[EMAIL PROTECTED]
Sent: Friday, April 02, 2004 4:44 PM
To: [EMAIL PROTECTED]
Subject: RE: Print PDF !!!

In java the ability to print PDF with the "new" Java printfinally wirks for PDF. You set the stream type to PDF and send it to the printer...

Like so:

        import java.io.*;
        import javax.print.*;
        import javax.print.attribute.*;
        import javax.print.attribute.standard.*;
        import javax.print.event.*;
   
        public class Print {
                public static void main(String[] args) {
                        try {
                                // Open the image file
                                InputStream is = new BufferedInputStream(
                                        new FileInputStream("filename.gif"));
   
                                // Find the default service
                                DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;
                                PrintService service =                                                                  PrintServiceLookup.lookupDefaultPrintService();

   
                                // Create the print job
                                DocPrintJob job = service.createPrintJob();
                                Doc doc = new SimpleDoc(is, flavor, null);

                                is.close();
                        } catch (IOException e) {
                        }
                }
}

CAVEAT: This does not work in 1.4


Rob


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 02, 2004 10:17 AM
To: [EMAIL PROTECTED]
Subject: RE: Print PDF !!!


yea, i went through this a onth ago and the only way to have a pdf pop
out the printer from java was to use the above approach, postscript
did not work for me, sonce there were diff in the printed doc, i went with
runtime exec and called abode32.exe


-----Original Message-----
From: Chris Bowditch [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 02, 2004 9:10 AM
To: [EMAIL PROTECTED]
Subject: Re: Print PDF !!!


[EMAIL PROTECTED] wrote:

> you can print pdfs from within java, assuming have xml and xsl use the
> follwoing

What you have suggested does not "print pdf" It uses java AWT classes to
build
the document and then print. AWT has differences from PDF or Postscript
outputs, which are designed to be the same.

<snip/>

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to