I have a programming that is using the P2D renderer and I want to save frames to a PDF at a button press. I simply want to implement this code from the PDF examples on the processing website.
import processing.pdf.*;
boolean record;
void setup() {
size(400, 400);
}
void draw() {
if (record) {
// Note that #### will be replaced with the frame number. Fancy!
beginRecord(PDF, "frame-####.pdf");
}
// Draw something good here
background(255);
line(mouseX, mouseY, width/2, height/2);
if (record) {
endRecord();
record = false;
}
}
// Use a keypress so thousands of files aren't created
void mousePressed() {
record = true;
}
Unfortunately, this implementation did not work for my code. It simply to produced blank PDF files. I tried simply switching the renderer to default, as it is in the example above and it was able to write a file with the image. However, my code uses PShapes and due to a bug in processing, it only looks correct using the P2D renderer, not the default. (this link shows why)
Is there a way around this? I really would like to save frames of my program to manipulate in Illustrator.