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…
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");
.