J'utilise le code de concaténation du site officiel avec la lib itext en version 1.1.
http://itext.ugent.be/library/com/lo...ncatenate.java
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
public void writeOutput(OutputStream output) throws IOException
    {
        try {
            int pageOffset = 0;
            ArrayList master = new ArrayList();
            int f = 0;
            Document document = null;
            PdfCopy  writer = null;
            while (f < pdfList.size())
            {
                // we create a reader for a certain document
                PdfReader reader = new PdfReader((byte[])pdfList.get(f)); //ligne déclanchant l'exception
                reader.consolidateNamedDestinations();
                // we retrieve the total number of pages
                int n = reader.getNumberOfPages();
                List bookmarks = SimpleBookmark.getBookmark(reader);
                if (bookmarks != null)
                {
                    if (pageOffset != 0)
                        SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null);
                    master.addAll(bookmarks);
                }
                pageOffset += n;
                
                if (f == 0)
                {
                    // step 1: creation of a document-object
                    document = new Document(reader.getPageSizeWithRotation(1));
                    // step 2: we create a writer that listens to the document
                    writer = new PdfCopy(document, output);
                    // step 3: we open the document
                    document.open();
                }
                // step 4: we add content
                PdfImportedPage page;
                for (int i = 0; i < n; ) {
                    ++i;
                    page = writer.getImportedPage(reader, i);
                    writer.addPage(page);
                }
                PRAcroForm form = reader.getAcroForm();
                if (form != null)
                    writer.copyAcroForm(reader);
                f++;
            }
            if (!master.isEmpty())
                writer.setOutlines(master);
            // step 5: we close the document
            document.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
J'obtiens pour certain pdf cette exception:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
java.io.IOException: Rebuild failed: trailer not found.; Original message: xref subsection not found at file pointer 8292
	at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
	at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
	at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
J'essaierai avec les versions supérieurs de itext plus tard, mais mon architecture actuelle (cocoon) utilise le 1.1.

Je précise que j'aurais bien mis les pdf posant problème en piece jointe, mais hélas, ils contiennent des info confidentielles.