From d04a3a010c2d623785aadf9c30cbd75da4bcdf2a Mon Sep 17 00:00:00 2001 From: ln803631 Date: Fri, 13 Sep 2019 21:06:10 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20modifications=20dans=20l'en-t?= =?UTF-8?q?=C3=AAte=20:=20-=20Titre=20et=20sous-titre=20du=20sujet=20centr?= =?UTF-8?q?=C3=A9s=20par=20rapport=20=C3=A0=20la=20page=20-=20Num=C3=A9ro?= =?UTF-8?q?=20d'identification=20de=20la=20page=20(ex=20:=20+1/1/60+)=20-?= =?UTF-8?q?=20Autres=20modifications=20de=20disposition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NGCC/src/GenerateurPdf/SubjectGenerator.java | 38 +++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/NGCC/src/GenerateurPdf/SubjectGenerator.java b/NGCC/src/GenerateurPdf/SubjectGenerator.java index 1cd0be7..eb71e1a 100644 --- a/NGCC/src/GenerateurPdf/SubjectGenerator.java +++ b/NGCC/src/GenerateurPdf/SubjectGenerator.java @@ -1,4 +1,4 @@ -package util; +package GenerateurPdf; import java.awt.Color; import java.io.IOException; @@ -83,12 +83,20 @@ public class SubjectGenerator { pdPageContentStream.newLineAtOffset(width - 236, height - 156); pdPageContentStream.showText("Ecrivez votre Nom"); pdPageContentStream.endText(); + // --- TODO : a optimiser --- \\ // dot lines pdPageContentStream.moveTo(width - 233, height - 175); for (int i = (width - 233); i <= (width - 90); i += 3) { pdPageContentStream.lineTo(i, height - 175); pdPageContentStream.moveTo(i + 2, height - 175); + } + pdPageContentStream.moveTo(width - 233, height - 190); + for (int i = (width - 233); i <= (width - 90); i += 3) { + pdPageContentStream.lineTo(i, height - 190); + pdPageContentStream.moveTo(i + 2, height - 190); + } + // --- TODO : a optimiser --- \\ pdPageContentStream.stroke(); // stroke @@ -101,6 +109,34 @@ public class SubjectGenerator { // pdPageContentStream.lineTo(width - 28, height - 239); pdPageContentStream.stroke(); // stroke + + pdPageContentStream.setFont(font, 11); + + // number (top of page) +n/n/nn+ + pdPageContentStream.beginText(); + pdPageContentStream.newLineAtOffset((width / 2) + 86, height - 30); + pdPageContentStream.showText("+1/1/60+"); + pdPageContentStream.endText(); + + pdPageContentStream.setFont(font, 12); + // Sujet + // center text : https://stackoverflow.com/a/6531362 + String subject = "Exemple PT S3T : de 1970 à l’an 2000, 30 ans d’histoire"; + int fontSize = 12; + float titleWidth = (font.getStringWidth(subject) / 1000) * fontSize; + float titleHeight = (font.getFontDescriptor().getFontBoundingBox().getHeight() / 1000) * fontSize; + pdPageContentStream.beginText(); + pdPageContentStream.newLineAtOffset((width - titleWidth) / 2, (height - 57 - titleHeight)); + pdPageContentStream.showText(subject); + pdPageContentStream.endText(); + + String subtitle = "Tricherie : Toutes consultations de sources numériques sont interdites !!"; + titleWidth = (font.getStringWidth(subtitle) / 1000) * fontSize; + pdPageContentStream.beginText(); + pdPageContentStream.newLineAtOffset((width - titleWidth) / 2, (height - 71 - titleHeight)); + pdPageContentStream.showText(subtitle); + pdPageContentStream.endText(); + pdPageContentStream.close(); } catch (IOException ioe) {