Flash Games

 FAQ   Search   Members   Groups   Register  User Control Panel      Login 

Your time now:
Mon Nov 23, 2009 8:30 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ]  Bookmark and Share
Author Message
 Post subject: I want to print an image with the following code, but .....
PostPosted: Fri May 25, 2007 9:44 am 
Offline

Joined: Mon Apr 23, 2007 2:10 pm
Posts: 13
Hai every one i want to an image, so the following code shows some internal error at run time can any one help me regarding this code:



Code:

    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
   
    public class BasicPrint {
        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.GIF;
                PrintService service = PrintServiceLookup.lookupDefaultPrintService();
   
                // Create the print job
                DocPrintJob job = service.createPrintJob();
                Doc doc = new SimpleDoc(is, flavor, null);
   
                // Monitor print job events; for the implementation of PrintJobWatcher,
                // see e702 Determining When a Print Job Has Finished
                PrintJobWatcher pjDone = new PrintJobWatcher(job);
   
                // Print it
                job.print(doc, null);
   
                // Wait for the print job to be done
                pjDone.waitForDone();
   
                // It is now safe to close the input stream
                is.close();
            } catch (PrintException e) {
            } catch (IOException e) {
            }
        }
    }


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review


Webmaster - Excruciating - Johnathan - Kotik - Ash - Tomi - rangana - Phate - dflynn - Medley