Outils pour utilisateurs

Outils du site


generer_un_pdf

Ceci est une ancienne révision du document !


Générer un PDF de plusieurs pages à partir d'un PGraphics

import processing.pdf.*;

void setup() {

size(400, 400);

}

void draw() { }

void keyPressed() {

int taillePDF = 10;
PGraphics pdf = createGraphics(400, 400, PDF, "Fichier.pdf");
pdf.beginDraw();
for (int i = 0; i < taillePDF; i++) {
  pdf.background(128, 0, 0);
  pdf.text(i + 1, width / 2, height / 2);
  if (i < taillePDF - 1) {
    ((PGraphicsPDF) pdf).nextPage();
  }
}
pdf.dispose();
pdf.endDraw();
println("Génération PDF terminée");

}

generer_un_pdf.1571389187.txt.gz · Dernière modification : 2019/10/18 08:59 de Mushussu