Outils pour utilisateurs

Outils du site


generer_un_pdf

Générer un PDF

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.txt · Dernière modification : 2019/10/18 09:04 de Mushussu