Hey, thanks for the super fast response!
"A PDF recorder must record drawing orders from the start, if you want a kind of "screenshot" effect."
So I should put a recorder in my void set up? (sorry to waste your time, I'm really new to this).
Also, I tried the code you proposed before, but I have this error message when I call the background(0):
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at processing.core.PApplet.runSketch(PApplet.java:9660)
at processing.core.PApplet.main(PApplet.java:9469)
Caused by: java.lang.NullPointerException
at processing.core.PApplet.fill(PApplet.java:13500)
at test_pdf.<init>(test_pdf.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at processing.core.PApplet.runSketch(PApplet.java:9658)
... 1 more