Bonjour,

Je développe une application et je chercher à y générer un fichier PDF depuis celle-ci comme j'avais fait en php sauf que là je souhaite le faire à partir de mon appli en java. J'ai trouvé la libraire iText mais je vois pas trop comment l'utiliser dans mon cas.
Voici ce que j'avais en php:
Script pour la création du fichier:
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
41
42
43
44
45
46
47
48
49
50
<?php
/**
 * HTML2PDF Librairy - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * @author      Laurent MINGUET <webmaster@html2pdf.fr>
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 */
 
    // get the HTML
    ob_start();
    include(dirname(__FILE__).'/congespdf.php');
    $content = ob_get_clean();
        $idConges = $_GET['idConges'];
 
        $req1 = "Select dateAction, nom, prenom
                    From conges
                    Join users On users.id = conges.users_id
                    where conges.id =".$idConges;
 
        //Exécution de la requête
        $res1 = $connexion->query($req1);
 
        //Affichage des informations dans le tableau 
        $row1 = $res1->fetch();
 
        if($row1['dateAction']==""):
            $accord = date('j-m-Y');
        else:
            $accord = $row1['dateAction'];
        endif;
 
    // convert to PDF
    require_once(dirname(__FILE__).'/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'fr');
        $html2pdf->pdf->SetDisplayMode('fullpage');
//      $html2pdf->pdf->SetProtection(array('print'), 'spipu');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output("conges_$row1[nom]_$row1[prenom]_$accord.pdf");
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
Script pour le contenu du fichier:
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php 
require('../includes/utilitaires.php');
require('../includes/accesBDD.php');
?>
 
<page orientation="portrait" >
    <bookmark title="Document" level="0" ></bookmark>
    <a name="document_reprise"></a>
    <?php
 
    	$idConges = $_GET['idConges'];
 
    	$req1 = "Select depot, typeConges, dateDbt, dateFin, commentaires, dateAction, nom, prenom
                    From conges
                    Join users On users.id = conges.users_id
                    where conges.id =".$idConges;
 
        //Exécution de la requête
        $res1 = $connexion->query($req1);
 
        //Affichage des informations dans le tableau 
        $row1 = $res1->fetch();
 
        $depot = convertirDateAnglaisVersFrancais($row1['depot']);
        $debut = convertirDateAnglaisVersFrancais($row1['dateDbt']);
        $fin = convertirDateAnglaisVersFrancais($row1['dateFin']);
 
        if($row1['dateAction']==""):
        	$accord = date('j-m-Y');
        else:
        	$accord = convertirDateAnglaisVersFrancais($row1['dateAction']);
        endif;
    ?>
 
 
    <p style="width: 25%;">
	    <img style="width: 120%" src="../img/inovagora.png" alt="Logo HTML2PDF">
	    <br>
	    <br>
	    <br>
    	<b style="width: 80%; text-decoration: underline; font-size: 23pt; margin-left: 280px;" >Accord congé &nbsp;</b>
    </p>
 
    <br/>
    <br/>
	<br/>
	<br/>
 
	<p style=" margin-left: 100px; border: solid 2px #000000; "><i style="font-size: 12pt;">Salarié : </i> <b style="font-size: 18pt;"><?php echo $row1['nom'].' '.$row1['prenom'];?></b></p>
 
	<p style=" margin-left: 130px; border: solid 2px #000000; "><i style="font-size: 12pt;">Dépôt : </i> <b style="font-size: 15pt;"><?php echo $depot;?></b></p>
 
	<br/>
	<br/>
	<br/>
	<br/>
 
	<p style=" margin-left: 290px; border: solid 2px #000000; "><b style="font-size: 20pt;"><?php echo $row1['typeConges'];?></b></p>
 
	<br/>
	<br/>
 
 
	<div style="font-size: 15pt;  background: #cfcfcf; margin-left:40px; margin-right:40px; padding-top:10px; padding-bottom:10px;" text-align="center">Du &nbsp; <b style="font-size: 30pt;"><?php echo $debut;?></b> &nbsp; au &nbsp; <b style="font-size: 30pt;"><?php echo $fin;?></b> </div>
 
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
 
    <?php 
    	if($row1['commentaires'] != ""):
    ?>
		<p style=" margin-left: 110px; border: solid 2px #000000; "><i style="font-size: 13pt;">Commentaire : </i> <b style="font-size: 15pt;"><?php echo $row1['commentaires'];?></b></p>
   	<?php
   		endif;
   	?>
   	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
 
	<table align="center" cellspacing="0" style=" width: 100%;">
	    <tr>
	    	<th style="width=40%; font-size: 15pt; border: 0.5px #000000; color:#b8b8b8;" text-align="center" ><br/>&nbsp;<br/>&nbsp;<br/>&nbsp;<i>Signature salarié</i><br/>&nbsp;<br/>&nbsp;<br/>&nbsp;</th>
	    	<th style="width=10%; font-size: 15pt; border: 0px #000000;" text-align="center"></th>
	    	<th style="width=40%; font-size: 15pt; border: 0.5px #000000; color:#b8b8b8;" text-align="center"><br/>&nbsp;<br/>&nbsp;<br/>&nbsp;<i>Signature responsable</i><br/>&nbsp;<br/>&nbsp;<br/>&nbsp;</th>
	    </tr>
	    <tr>
	    	<th></th>
	    	<th></th>
	    	<th><i>&nbsp;Date accord : <?php echo $accord;?></i></th>
	    </tr>
	</table>
</page>
Merci de votre aide