Bonjour,
Débutant en Java, je dois faire un programme me renvoyant des statistiques sur les différentes versions utilisées pour des documents Pdf. J'utilise la librairie PdfBox.
Voila ce que j'ai fait pour l'instant et ce que me renvoit ce programme :
- OpenOffice.org 2.2
- AFPL Ghostscript 8.50
- PDF-XChange 3.60.0102 (Windows XP)
- AFPL Ghostscript 8.51
- GPL Ghostscript 8.63
- GNU Ghostscript 7.06
- Mac OS X 10.6.1 Quartz PDFContext
- Microsoft® Office Word 2007
- ...
Par contre, je ne vois pas comment je peux exploiter ces données pour en faire des stats. Avez-vous une petite idée?
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 import java.io.File; import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentInformation; public class Pdf { private static String fileName; public Pdf() { } public void findVersion () throws IOException { File f = new File(fileName); PDDocument pdf = PDDocument.load(f); PDDocumentInformation info = pdf.getDocumentInformation(); pdf.close(); System.out.println(info.getProducer()); } public static void main(String[] args) throws IOException { File rep = new File("C:/FICHIERS/pdf"); File[] list = rep.listFiles(); for (int i = 0 ; i < list.length ; i++) { fileName = list[i].getAbsolutePath(); Pdf p = new Pdf(); p.findVersion(); } } }
Partager