s'il vous plais comment je peux avoir une transformation parfaite d'un document pdf en document txt.

avec quelques recherche j'utilise ce code

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
import org.jdom2.*;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.*;
////pour PDF
import com.qoppa.pdfText.PDFText;
import java.io.*;
 
import java.io.FileWriter;
import java.util.List;
import java.util.Vector;
import java.lang.*;
import java.util.*;
 
import javax.swing.JTextField;
public class PDF {
 
static org.jdom2.Document document ;
private JTextField textbox1;
private static Acceuil2 acc;
public JTextField getTextbox1() {
    return textbox1;
}
 
public void setTextbox1(JTextField textbox1) {
    this.textbox1 = textbox1;
}
    static void affiche()
    {
    try
    {
    //On utilise ici un affichage classique avec getPrettyFormat()
    XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
    sortie.output(document, System.out);
    }
    catch (java.io.IOException e){}
    }
     static void enregistreFichier(String fichier) throws Exception
       {
             XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
             sortie.output(document, new FileOutputStream(fichier));
       }
 
 
    ///////// main
 
    public  static void main (String []Args)
 
    {
        String chemin= acc.getTextbox1().getText();
         try
            {
                // Load the document
 
    PDFText pdfText = new PDFText("chemin", null);
 
        String docText = pdfText.getText();
 
        // Save the text in a file
        FileWriter output = new FileWriter ("output.xml");
        output.write(docText);
        output.close();
    }
    catch (Throwable t)
    {
        t.printStackTrace();
    }
 
    String fichier ="output.txt";
    //le fichier XML
    String fichierXML ="Exercice1.xml";
    //les attributs à insérer dans le xml
    String name = "";
 
    String chaine="";
 
    //lecture du fichier texte 
    try{
        InputStream ips=new FileInputStream(fichier);
        InputStreamReader ipsr=new InputStreamReader(ips);
        BufferedReader br=new BufferedReader(ipsr);
 
        /// récupération de tous le texte dans une chaine
        String ligne;
        while ((ligne=br.readLine())!=null){
            System.out.println(ligne);
            chaine+=ligne+"\n";
        }
        br.close();
    }      
    catch (Exception e){
        System.out.println(e.toString());
    }
 
}
 
    }
le résultat que je trouve c'est que plusieurs mots sont transformés en (DEMO ).
existe t'il une autre méthode plus performante sans les mots (DEMO).
Merci d'avance