TimoL
1
I’ve run into this problem where my pdf is coming out blank even though there is stuff on the screen.
I think it has to do with how I’m drawing to the canvas using mousePressed.
any ideas?
import processing.pdf.*;
boolean record = false;
void setup() {
size(500, 500);
background(255);
}
void draw () {
if (record) {
beginRecord(PDF, "frame-####.pdf");
}
if (record) {
endRecord();
record = false;
}
}
void mousePressed() {
circle(mouseX, mouseY, 50);
}
void keyPressed() {
if (key == 's') {
record = true;
println("SAVED");
}
}
1 Like
jb4x
2
Hi @TimoL,
You need to start the recording before you draw on the screen for the capture to work.
TimoL
3
hmm
I’ve tried initialising record as true but I still get a blank pdf.
Btw if you run the code and then click a few times to draw circles then press ‘s’ to save a frame the frame is blank.
any hints
jb4x
4
Even if you set it to true at the top, the first time you enter the draw loop it is set to false.
import processing.pdf.*;
void setup() {
size(500, 500);
background(255);
beginRecord(PDF, "frame-####.pdf");
}
void draw () {
}
void mousePressed() {
circle(mouseX, mouseY, 50);
}
void keyPressed() {
if (key == 's') {
endRecord();
exit();
}
}
1 Like
TimoL
5
Oh I see! thanks you so much