# Editable text in PDF

**URL:** <https://discourse.processing.org/t/editable-text-in-pdf/32526>\
**Category:** Gallery\
**Created:** [September 30, 2021, 1:28pm UTC](https://discourse.processing.org/t/editable-text-in-pdf/32526 "2021-09-30T13:28:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clankill3r](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/clankill3r/32/1098_2.png) [@clankill3r](https://discourse.processing.org/u/clankill3r)\
**Post date:** [September 30, 2021, 1:28pm UTC](https://discourse.processing.org/t/editable-text-in-pdf/32526/1 "2021-09-30T13:28:55Z")

</div>

Some people might remember that in the days of Processing 1 you could export to PDF and edit the text in Illustrator. This has been broken down the road and has never been restored.  
Here is a small class that can export to PDF where you can edit the text in Illustrator.  
It does not export the right font, but that can be changed in Illustrator…

```java
import processing.core.*;
import processing.pdf.*;

public class PGraphicsPDF2 extends PGraphicsPDF {
  
  static boolean listFonts_has_been_called = false;
  
  public PGraphicsPDF2() {
    if (!listFonts_has_been_called) {
      // Without this PDF export does not work
      PGraphicsPDF.listFonts();
      listFonts_has_been_called = true;
    }
  }
  
  public void textMode(int mode) {
    if (textMode != mode) {
      if (mode == SHAPE) {
        textMode = SHAPE;
        g2.dispose();
// g2 = content.createGraphicsShapes(width, height);
        g2 = createGraphics();
      } else if (mode == MODEL) {
        textMode = MODEL;
        g2.dispose();
       g2 = content.createGraphics(width, height, mapper); //@Doeke_PDF
        // g2 = createGraphics();
// g2 = template.createGraphics(width, height, mapper);
      } else if (mode == SCREEN) {
        throw new RuntimeException("textMode(SCREEN) not supported with PDF");
      } else {
        throw new RuntimeException("That textMode() does not exist");
      }
    }
  }
  
}

```

Use with `beginRecord("PGraphicsPDF2", "out/test.pdf");`.
