Hello
Im having som problems with the getImages function in the PDResources
resources. I works with some pdf document, but not others. Im attaching
a document where only one image gets listed, but the document contains
two images.
It's a 1.4 pdf file. Basically Im using the standare extracImages code. Im not sure vere to upload the file to.

It to large to include in the mail.


Best regards
/ Pontus

Here is my code:

        ListIterator pages =
pdfDoc.getDocumentCatalog().getAllPages().listIterator();
        int i = 0;
        while( pages.hasNext() )
        {
            PDPage page = (PDPage)pages.next();

            PDResources resources = page.getResources();
            Map images = null;
            Map x_images = null;
            try {
                images = resources.getImages();
                x_images = resources.getXObjects();
            } catch(java.io.IOException ioEx) {
                answer = "<filelist><error>Error No: 1102,
createPreviews resources.getImages() IOException</error></filelist>";
            } catch(java.lang.NullPointerException npex) {
                answer = "<filelist><error>Error No: 1103,
createPreviews resources.getImages()
NullPointerException</error></filelist>";
                return answer;
            }
            int nofImages = images.size();
            int nofKeys = images.keySet().size();
            int    imageIndex = 0;
            imageIndex = 0;


            if( images != null ) {
                Iterator imageIter = images.keySet().iterator();

                while( imageIter.hasNext())
                {
                    String key = (String)imageIter.next();
                    imageIndex = imageIndex + 1;
                    PDXObjectImage image = (PDXObjectImage)images.get(
key );
                }
             }
          }




Reply via email to