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

**URL:** <https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053>\
**Category:** Coding Questions\
**Created:** [May 22, 2023, 11:17pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053 "2023-05-22T23:17:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewcooke](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andrewcooke/32/18406_2.png) [@andrewcooke](https://discourse.processing.org/u/andrewcooke)\
**Post date:** [May 22, 2023, 11:17pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/1 "2023-05-22T23:17:51Z")

</div>

Hi,

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:

```auto
void draw() {
  beginRecord(PDF, "triangles.pdf");
  background(bg);

  draw_triangles();
  
  //saveFrame("frames/####.tiff");
  save("triangles.png");
  endRecord();
}

```

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

Thanks,  
Andrew

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [May 23, 2023, 9:10am UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/2 "2023-05-23T09:10:23Z")

</div>

Welcome to the forum.

> [@andrewcooke](#):
>
> I’m not sure I should post all the code here, but the main routine looks like:

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.

> [@andrewcooke](#):
>
> Finally, just to emphasise - PDF output works fine with similar code in many other sketches.

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

---

<div class="post-metadata">

**Author:** ![Christian](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@Christian](https://discourse.processing.org/u/Christian)\
**Post date:** [May 23, 2023, 9:14am UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/3 "2023-05-23T09:14:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JSGauthier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jsgauthier/32/9910_2.png) [@JSGauthier](https://discourse.processing.org/u/JSGauthier)\
**Post date:** [May 23, 2023, 2:24pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/4 "2023-05-23T14:24:23Z")

</div>

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().

```auto
int renderPass;

println("renderPass = " + renderPass);
renderPass++;

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

void endPDF() {  
  if (renderPass ==2) {
    endRecord();
    println("Finished.");
    exit();
  }
}

```

Good luck!

---

<div class="post-metadata">

**Author:** ![andrewcooke](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andrewcooke/32/18406_2.png) [@andrewcooke](https://discourse.processing.org/u/andrewcooke)\
**Post date:** [May 23, 2023, 3:14pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/5 "2023-05-23T15:14:10Z")

</div>

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](https://github.com/processing/processing4/issues/725)

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

---

<div class="post-metadata">

**Author:** ![JSGauthier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jsgauthier/32/9910_2.png) [@JSGauthier](https://discourse.processing.org/u/JSGauthier)\
**Post date:** [May 23, 2023, 4:51pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/6 "2023-05-23T16:51:52Z")

</div>

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:

> [@Guidelines—Answering Questions](https://discourse.processing.org/t/guidelines-answering-questions/2145):
>
> If you’re here, it means you’re thinking about contributing to the Processing community by answering questions on the forum. That’s great! This guide is meant to help you answer questions in a way that’s most helpful. Be nice. Remember that you’re talking to a person! Follow the guidelines in the [FAQ](https://discourse.processing.org/faq). Also read through the [P5.js community guidelines](https://p5js.org/community/). Specifically, avoid making judgments like “this code is bad” or “that’s a dumb way to do this”. Be mindful of how your tone comes across over the…

Take care & best of luck with your sketches.

[https://discourse.processing.org/t/guidelines-asking-questions/2147/8](https://discourse.processing.org/t/guidelines-asking-questions/2147/8)

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [May 23, 2023, 8:01pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/7 "2023-05-23T20:01:43Z")

</div>

> [@andrewcooke](#):
>
> Is there any kind of log that I should check?

No.

> [@andrewcooke](#):
>
> Or a way to run processing more verbosely?

No.

> [@andrewcooke](#):
>
> Is this a known issue? I did a quick search on github and saw no suitable issue (open or recently closed).

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. 😇

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 23, 2023, 11:45pm UTC](https://discourse.processing.org/t/blank-pdf-output-for-one-particular-sketch-checking-before-submitting-a-bug-report/42053/8 "2023-05-23T23:45:14Z")

</div>

See solution on GitHub:

[https://github.com/processing/processing4/issues/725#issuecomment-1560251748](https://github.com/processing/processing4/issues/725#issuecomment-1560251748)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/a/1a717e83cc8c6e1a5fe43d7293b0c8c9bdd7ea0f.png)

`:)`
