# Create PDF runtime error with v4.4.7

**URL:** <https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174>\
**Category:** Coding Questions\
**Created:** [September 18, 2025, 4:13pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174 "2025-09-18T16:13:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geoffree3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geoffree3/32/21102_2.png) [@Geoffree3](https://discourse.processing.org/u/Geoffree3)\
**Post date:** [September 18, 2025, 4:13pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/1 "2025-09-18T16:13:55Z")

</div>

Creating a pdf of drawing to the screen with beginRecord(PDF, fileName) now gives and error:  
“java.lang.RuntimeException: Use createFont() instead of loadFont() when drawing text using the PDF library”  
My code uses createFont() and it used to work fine until this update to 4.4.7

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [September 19, 2025, 7:35am UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/3 "2025-09-19T07:35:45Z")

</div>

Hi @Geoffree3 and welcome to the forum!

What is your operating system and could you share a minimal sketch that produces the error?

I tried the following using 4.4.47 on Windows 10 and wasn’t able to reproduce the issue:

```processing
import processing.pdf.*;
PFont myFont;

void setup() {
  size(400, 400);
  pixelDensity(1);
  beginRecord(PDF, "everything.pdf");
  myFont = createFont("Georgia", 32);
}

void draw() {
  background(0);
  textFont(myFont);
  textAlign(CENTER, CENTER);
  text("!@#$%", width/2, height/2);
  endRecord();
  exit();
}

```

---

<div class="post-metadata">

**Author:** ![stefterv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stefterv/32/21678_2.png) [@stefterv](https://discourse.processing.org/u/stefterv)\
**Post date:** [September 19, 2025, 9:46am UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/4 "2025-09-19T09:46:40Z")

</div>

```auto
import processing.pdf.*;
PFont myFont;

void setup() {
  size(400, 400);
  pixelDensity(1);
  beginRecord(PDF, "everything.pdf");
  myFont = loadFont("AlTarikh-48.vlw");
}

void draw() {
  background(0);
  textFont(myFont);
  textAlign(CENTER, CENTER);
  text("!@#$%", width/2, height/2);
  endRecord();
  exit();
}

```

I just tried this with 4.3.4 and I get the same error, what version was it still working for you @Geoffree3 ?

---

<div class="post-metadata">

**Author:** ![Geoffree3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geoffree3/32/21102_2.png) [@Geoffree3](https://discourse.processing.org/u/Geoffree3)\
**Post date:** [September 19, 2025, 11:53am UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/5 "2025-09-19T11:53:02Z")

</div>

I just upgraded to 4.4.7. BTW, the loadFont() will cause an error. createFont(), as in sableraph’s example, should be OK.

---

<div class="post-metadata">

**Author:** ![Geoffree3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geoffree3/32/21102_2.png) [@Geoffree3](https://discourse.processing.org/u/Geoffree3)\
**Post date:** [September 19, 2025, 12:16pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/6 "2025-09-19T12:16:01Z")

</div>

The other problem, is that the pdf only includes top left quarter of the processing window, so I have to increase the size dimensions by a factor of 2. e.g. draw a square {square(0,0,1000)} needs size(2000, 2000). I’m using an iMac.

---

<div class="post-metadata">

**Author:** ![stefterv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stefterv/32/21678_2.png) [@stefterv](https://discourse.processing.org/u/stefterv)\
**Post date:** [September 19, 2025, 12:42pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/7 "2025-09-19T12:42:22Z")

</div>

Add `pixelDensity(1)` to your `void setup(){` we’re adding a notice for that in 4.4.8!

---

<div class="post-metadata">

**Author:** ![Geoffree3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geoffree3/32/21102_2.png) [@Geoffree3](https://discourse.processing.org/u/Geoffree3)\
**Post date:** [September 19, 2025, 12:59pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/8 "2025-09-19T12:59:39Z")

</div>

Many thanks. Solved the pdf scaling problem.

---

<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:** [September 29, 2025, 10:16pm UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/9 "2025-09-29T22:16:45Z")

</div>

> [@stefterv](#):
>
> Add `pixelDensity(1)` to your `void setup(){` we’re adding a notice for that in 4.4.8!

Hello @stefterv,

Can we also add an entry to the Wiki about this:

> **[Home](https://github.com/processing/processing4/wiki)**
>
> Source code for Processing, the software sketchbook and Java-based programming language for students, artists, designers, educators, hobbyists, and creative coders. Includes the core library, and e...

The _Troubleshooting_ section would be a good spot for it.

`:)`

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [September 30, 2025, 11:10am UTC](https://discourse.processing.org/t/create-pdf-runtime-error-with-v4-4-7/47174/11 "2025-09-30T11:10:50Z")

</div>

Thanks @glv, that’s a good idea 👍

I have added a section to the Troubleshooting page [here](https://github.com/processing/processing4/wiki/Troubleshooting#my-sketch-has-the-wrong-scale-in-newer-versions-of-processing-or-when-exporting-a-pdfsvg).

You may also direct people to this wiki page: [Pixel Density Changes](https://github.com/processing/processing4/wiki/Pixel-Density-Changes)
