PDF-export

int a = 0;


void setup() {
  size(540, 540);
}

void draw() {

  ellipse(width/2,height/2,a,a);
a++;

// Call the pdf-export-function and 
// specify the number of frames you want to render
pdf(100);

}

The pdf-export-function can be stored in a separate file (pdfexport.pde)

import processing.pdf.*;
PGraphicsPDF pdf;

void pdfsetup() {
  // new pdf
  pdf = (PGraphicsPDF) createGraphics(width, height, PDF, "PdfTest.pdf");
  beginRecord(pdf);
}

void pdf(int pages) {

  if (frameCount == 1) {
    pdfsetup();
  }

  pdf.nextPage();


  if (frameCount == pages) {
    endRecord();
    exit();
  }
}

results matching ""

    No results matching ""