Bonjour a tous, je cherche à partir du code de ma page à créer un PDF grace jpdfwriter.
J'ai un petit probleme au niveau de mon
Code : Sélectionner tout - Visualiser dans une fenêtre à part
File outFile = getOutputFile();
Il ne trouve pas la méthode getoutputfile et je ne sais pas avec quelle librairie je peux l'avoir.
Si vous avez une petite idée faites moi signe.

Voici le code de la page. Pour l'instant c'est un test.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public class Pdfclass extends com.qoppa.pdfWriter.DocumentInfo{
 
 
    public static void main(String[] args) throws IOException {
 
        PDFDocument pdfDoc = new PDFDocument();
// create page 
        PDFPage page = pdfDoc.createPage(null);
 
// add page to document 
        pdfDoc.addPage(page);
 
// get graphics object from the page 
        Graphics2D g2d = page.createGraphics();
 
// draw a red rectangle
        g2d.setColor(Color.red);
        g2d.fillRect(100, 100, 400, 200);
 
// draw a round border to the rectangle
        g2d.setStroke(new BasicStroke(6));
        g2d.setColor(Color.black);
        g2d.drawRoundRect(100, 100, 400, 200, 10, 10);
 
// draw a string 
        g2d.setFont(new Font("Helvetica", Font.BOLD, 36));
        g2d.setColor(Color.white);
        g2d.drawString("Qoppa Software", 150, 200);
 
// … some more commands to draw a yellow oval and to draw a string at an angle 
// see jbPrintGraphics_ActionEvents method
 
// get a file name
        File outFile = getOutputFile();
        if (outFile != null) {
            //save the document
            pdfDoc.saveDocument(outFile.getAbsolutePath());
        }
    }
}