This post here have some related issue:
http://forum.processing.org/topic/making-a-pdf-file
And a working code I've got here w/ me:
http://forum.processing.org/topic/making-a-pdf-file
And a working code I've got here w/ me:
// http://forum.processing.org/topic/pdf-export-shapes-misaligned import processing.pdf.*; final static boolean RECORD = true; final static int DIAM = 300; final static int STEP_X = 15, STEP_Y = 15; final static float FRACT = 1.15; final static color BG = #556270; final color[] palette = { #4ECDC4, #C7F464, #FF6B6B, #C44D58 }; void setup() { size(960, 645); noLoop(); initialize(); // initializes main canvas setup } void draw() { if (RECORD) { final String path = dataPath("frame-####.pdf"); beginRecord(PDF, path); initialize(); // initializes PDF's own graphics setup } background (BG); final int xx = width; final int yy = height + DIAM; for (int y = STEP_Y; y < yy; y += DIAM + STEP_Y) { for (int x = STEP_X; x < xx; x += DIAM + STEP_X) { drawCircle(x, y, DIAM); } } if (RECORD) { endRecord(); println("Frame: #" + frameCount); } } void mouseClicked() { redraw(); } void drawCircle(int x, int y, float d) { fill(palette[(int) random(palette.length)]); ellipse(x, y, d, d); if (d > 2) { drawCircle(x, y, d/FRACT); } } void initialize() { smooth(); noStroke(); ellipseMode(CORNER); }