Blank PDF output for one particular sketch - checking before submitting a bug report


I’ve only been using processing (v4) for a short time, but am having a lot of fun generating various images. These are all based on a similar structure (I tend to develop the code incrementally, saving each step as a new sketch) and I have just realised, while revising saved plots for possible printing, that one particular sketch generates blank PDF files. The PNG output is fine, as is the display to the screen, and there are no errors displayed anywhere that I can see.

So I have a couple of questions:

  • Is there any kind of log that I should check? Or a way to run processing more verbosely?

  • Is this a known issue? I did a quick search on github and saw no suitable issue (open or recently closed).

I’m not sure I should post all the code here, but the main routine looks like:

void draw() {
  beginRecord(PDF, "triangles.pdf");


Finally, just to emphasise - PDF output works fine with similar code in many other sketches.


Welcome to the forum.

Can’t test the code without the full sketch code. If the code is too long try and shorten it so that it will still demonstrate the problem.

In this case it probably isn’t a bug in Processing.

1 Like

Does it work when you draw something else – let’s say a simple line?

I had to deal with a similar issue and found I needed to do more than one pass in the draw loop in order to have all my content printed in the .pdf.

also make sure that you name the .pdf file it helps.

I made a renderPass variable which was incremented in draw().

int renderPass;

println("renderPass = " + renderPass);

void startPDF() {
    if (renderPass == 1) {
    beginRecord(PDF, "fileName.pdf");

void endPDF() {  
  if (renderPass ==2) {

Good luck!

1 Like

i think the PDF stroke is not tracking the changed range of opacities set in colorMode (while output to a png or the screen does). see No PDF Output (connected to stroke opacity, colorMode) · Issue #725 · processing/processing4 · GitHub

also, the comments here were useless. no-one even tried to answer the questions i actually asked.

Next time I’ll be happy to take greater care to read members questions.

Please be advised:

Regardless of how you value people’s contributions remember this is an inclusive community. Myself and others did try to communicate with you and help you in a good way. Maybe it wasn’t what you were seeking but, we took time to read your post and tried to help. No need to state that people’s contribution are useless. Instead you can simply thank others for their efforts and move on. Or keep dismissive statements as such to yourself.

In this way the relationships of reciprocity and kindness within the forum are respected.

Here is a link to the community guidelines, should you have missed them when joining the forum:

Take care & best of luck with your sketches.




Since you have successfully used PDF output in many similar projects what makes you think it is an issue with Processing rather than your code?

Hope this answers your questions. :innocent:

1 Like

See solution on GitHub: