  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: printing in p5  (Read 2124 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            pinkwalker 
 
                  
      
             | 
            
            
            
              
                
                printing in p5 
                «  on: May 26th, 2004, 5:09am » | 
                
                
 
                 | 
               
             
             
            
            I'm working in an applet and i need to print the images as seen in the screen. Has any one idea?      Gabriel 
            
             | 
           
            
            
            
             *************** www.pinkwalker.tk
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            amoeba 
 
        
      
             | 
            
            
            
              
                
                Re: printing in p5 
                « Reply #1 on: May 26th, 2004, 9:34am » | 
                
                
 
                 | 
               
             
             
            
            Hi Gabriel,      Try using Toxi's BAppLauncher hack (see Toxi's post further down on the page). You'll need a Java run-time (available from www.java.com).      BAppLauncher allows you to run your applet in an application context, which means you can use saveFrame() as usual. 
            
             | 
           
            
            
            
              
                | « Last Edit: May 26th, 2004, 9:35am by amoeba » | 
                  | 
               
             
             marius watz // amoeba http://processing.unlekker.net/ 
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            forkinsocket 
  
        
      
             | 
            
            
            
              
                
                Re: printing in p5 
                « Reply #3 on: Nov 21st, 2004, 11:10am » | 
                
                
 
                 | 
               
             
             
            
            hi pinkwalker,      i had to do this recently. there is some great sample code in a book called "java cookbook" published by oreilly press that i found helpful; i repeat it here for your benefit. this is known to work in processing 67 on os x.       to print, call the method printscreendavid().       void printscreendavid()   {     // java 1.1 version -- this totally works but brings up an os print dialog. i'm not so fond of those.     /*     // fetch printjob object from toolkit     PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(new Frame(), "test", null);        // fetch graphics object to draw on (this is what printer sees).     Graphics pg = pj.getGraphics();        // ask window to paint itself on printer's graphics object     super.paint(pg);        // say byebye and clean up     pg.dispose();     pj.end();     */        // java 1.2 -- can print in background which is nicer     try {       java.awt.print.PrinterJob pjob = java.awt.print.PrinterJob.getPrinterJob();       pjob.setJobName("FingerprintMazeMap -- You are there.");       pjob.setCopies(1);       pjob.setPrintable(new java.awt.print.Printable() {    public int print(Graphics pg, java.awt.print.PageFormat pf, int pageNum) {      if (pageNum > 0)      return java.awt.print.Printable.NO_SUCH_PAGE; // end of job         superPaint(pg);         return java.awt.print.Printable.PAGE_EXISTS;    }       });              // calling printDialog forces an OS print dialog -- we don't like os dialogs       //  if (pjob.printDialog() == false)       //return;              pjob.print();     } catch (java.awt.print.PrinterException pe) {        }   }      void superPaint(Graphics g) {     super.paint(g);   }   
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
 
 |