Title: RE: [iText-questions] problem with bookmark

ok thanks this looks like what I'm looking for:) but when I try it I have a bug during execution:

this is my code:

                PdfReader pdfReader = new PdfReader(myPdfDocuments[currIdx]);
                List list = SimpleBookmark.getBookmark(pdfReader);

and the execution stop at the red line below:
in bookmarkDepth's method

 else {
                PdfDictionary action = (PdfDictionary)PdfReader.getPdfObject(outline.get                                                                                                                        (PdfName.A));

                if (action != null) {
                    if (PdfName.GOTO.equals(PdfReader.getPdfObject(action.get                                                                                                                                                           (PdfName.S)))) {

                        dest = PdfReader.getPdfObject(action.get(PdfName.D));
                        if (dest != null) {
                            if (dest.type() == PdfObject.STRING)
                                map.put("Named", dest.toString());
                            else if (dest.type() == PdfObject.NAME)
                                map.put("Named", PdfName.decodeName(dest.toString()));
                            else if (dest.type() == PdfObject.ARRAY) {
                                ArrayList arr = ((PdfArray)dest).getArrayList();
                                StringBuffer s = new StringBuffer();
                                s.append(pages.get(((PdfIndirectReference)arr.get                                                                                                                                                               (0)).getNumber()));

                                s.append(' ').append(arr.get(1).toString().substring(1));
                                for (int k = 2; k < arr.size(); ++k)
                                    s.append(' ').append(arr.get(k).toString());
                                map.put("Page", s.toString());
                            }
                            map.put("Action", "GoTo");
                        }
                    }


the error is:

java.lang.ClassCastException: com.lowagie.text.pdf.PdfNumber
        at com.lowagie.text.pdf.SimpleBookmark.bookmarkDepth(SimpleBookmark.java:131)
        at com.lowagie.text.pdf.SimpleBookmark.getBookmark(SimpleBookmark.java:219)
        at org.epo.bli.scenario.extractor.jpdvd.JpDvdExtractor.run(JpDvdExtractor.java:340)

I hope you can help me again:) because I'm a little lost a the time:)

thanks:)

Reply via email to