Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      windows server 2008, tomcat 7

      Description

      Every time we convert a pdf to image .in the log of tomcat it prints this message:

      Sep 10, 2013 7:09:26 AM org.icepdf.core.util.LazyObjectLoader loadObject
      SEVERE: Error loading object instance: 58 0R
      java.io.IOException: The handle is invalid
      at java.io.RandomAccessFile.getFilePointer(Native Method)
      at org.icepdf.core.io.RandomAccessFileInputStream.getAbsolutePosition(RandomAccessFileInputStream.java:122)
      at org.icepdf.core.util.LazyObjectLoader.loadObject(LazyObjectLoader.java:70)
      at org.icepdf.core.util.Library.getObject(Library.java:123)
      at org.icepdf.core.util.Library.getObject(Library.java:173)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:223)
      at org.icepdf.core.pobjects.graphics.ImageStreamReference.run(ImageStreamReference.java:66)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

        Activity

        Hide
        Patrick Corless added a comment -

        Could you give me a little more information on how you are using ICEpdf in your applications. Fore example does each request have an instance of ICEpdf's Document class or do you have some type of Document pool?

        Are you using 5.0 or 5.0.3?

        Show
        Patrick Corless added a comment - Could you give me a little more information on how you are using ICEpdf in your applications. Fore example does each request have an instance of ICEpdf's Document class or do you have some type of Document pool? Are you using 5.0 or 5.0.3?
        Hide
        Yassine El Bouamri added a comment -

        We use the version 5.0.2 and the code is :

        public static byte[][] convertPDFtoPNG(File src, float scale, int start, int end) throws Exception {

        if (!isPDF(src))

        { throw new Exception("El fichero de origen debe ser un *.pdf"); }

        Document document = new Document();

        document.setFile(src.getAbsolutePath());
        if (end == -1 || end > document.getNumberOfPages())

        { end = document.getNumberOfPages(); }

        ByteArrayOutputStream baous = null;
        BufferedImage image = null;
        byte[][] data = new byte[end - start + 1][];
        try {
        int index = 0;
        for (int i = start - 1; i < end; i++)

        { baous = new ByteArrayOutputStream(); image = (BufferedImage) document.getPageImage( i, GraphicsRenderingHints.PRINT, Page.BOUNDARY_CROPBOX, 0, scale); ImageIO.write(image, "png", baous); data[index] = baous.toByteArray(); index++; image.flush(); image = null; baous.flush(); baous.close(); }

        } finally

        { document.dispose(); }

        return data;

        }

        Show
        Yassine El Bouamri added a comment - We use the version 5.0.2 and the code is : public static byte[][] convertPDFtoPNG(File src, float scale, int start, int end) throws Exception { if (!isPDF(src)) { throw new Exception("El fichero de origen debe ser un *.pdf"); } Document document = new Document(); document.setFile(src.getAbsolutePath()); if (end == -1 || end > document.getNumberOfPages()) { end = document.getNumberOfPages(); } ByteArrayOutputStream baous = null; BufferedImage image = null; byte[][] data = new byte [end - start + 1] []; try { int index = 0; for (int i = start - 1; i < end; i++) { baous = new ByteArrayOutputStream(); image = (BufferedImage) document.getPageImage( i, GraphicsRenderingHints.PRINT, Page.BOUNDARY_CROPBOX, 0, scale); ImageIO.write(image, "png", baous); data[index] = baous.toByteArray(); index++; image.flush(); image = null; baous.flush(); baous.close(); } } finally { document.dispose(); } return data; }
        Hide
        Patrick Corless added a comment -

        Closing, lack of sample file and not contact for over a year.

        Show
        Patrick Corless added a comment - Closing, lack of sample file and not contact for over a year.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Yassine El Bouamri
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: