[Code Snippet] Specifying PDF page size in Processing (Processing 2.0 alpha)
              in 
             Share your Work 
              •  
              1 year ago    
            
 
           
             
              Here is an updated version of the code toxi posted to define din A0, A1, A2, A3, A4 paper formats using iText. Might be helpful for someone.
             
             
              
             
             
              - import processing.pdf.*;
 
              - import com.lowagie.text.PageSize;
 
              - import com.lowagie.text.Rectangle;
 
              
 
              - void setup() {
 
              -  // create window @ A3 landscape using OPENGL
 
              -  pageSize(com.lowagie.text.PageSize.A3,true,OPENGL);
 
              -  // create window @ US Letter size, portrait using default renderer
 
              -  //pageSize(com.lowagie.text.PageSize.LETTER,false,JAVA2D);
 
              - }
 
              
 
              - /**
 
              - * Convenience method to be used instead of the normal size() command.
 
              - * Creates window matched to a given paper size
 
              - *
 
              - * @param r a predefined constant of the iText PageSize class
 
              - * @param isLandscape true, if you want landscape orientation
 
              - * @param renderer class name of the Processing renderer to use
 
              - */
 
              - void pageSize(com.lowagie.text.Rectangle r, boolean isLandscape, String renderer) {
 
              -  if (isLandscape) {
 
              -  size((int)r.getHeight(),(int)r.getWidth(),renderer);
 
              -  } else {
 
              -  size((int)r.getWidth(),(int)r.getHeight(),renderer);
 
              -  }
 
              - }
 
             
 
           