Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.3, 2.0.0
    • Component/s: None
    • Environment:
      Windows 8
      JDK 1.7
      Jboss 7.1

      Description

      I'm in the fight to perfectly convert a PDF to an image.
      But the stacktrace below breaks my application!


      Out 02, 2013 3:22:35 PM org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap getRGBImage
      SEVERE: Something went wrong ... the pixelmap doesn't contain any data.
      Out 02, 2013 3:22:35 PM org.apache.pdfbox.util.operator.pagedrawer.Invoke process
      WARNING: getRGBImage returned NULL
      Out 02, 2013 3:22:35 PM org.apache.pdfbox.util.PDFStreamEngine processOperator
      INFO: unsupported/disabled operation: i


      I really need to fix this problem in order to succeed in converting
      You know why this error occurs?
      You know how I can fix this error?
      is some dependence of my environment that i forgot? or a failure of PDFBox framewor ?

      Follow my code below:

      public static List<BufferedImage> getPdfPagesAsImages(String pdfPath, int i)
      throws FileNotFoundException, IOException {
      List<BufferedImage> bImages = new ArrayList<BufferedImage>();

      File f = new File(pdfPath);
      if (f.exists()) {
      int resolution = 185;
      PDDocument pdfDocument = null;

      pdfDocument = PDDocument.loadNonSeq(f, null);

      if (pdfDocument != null) {
      @SuppressWarnings("unchecked")
      List<PDPage> pages = (List<PDPage>) pdfDocument
      .getDocumentCatalog().getAllPages();
      int j = 1;
      for (PDPage p : pages) {
      System.out.println(j);
      BufferedImage convertedImage = p.convertToImage(
      BufferedImage.TYPE_INT_BGR , resolution);
      saveImageToRepository(i, j, convertedImage);
      j++;
      if (isNegativeImage(convertedImage))

      { bImages.add(invertNegativeImage(convertedImage)); }

      else

      { bImages.add(convertedImage); }

      }
      System.out.println(pdfPath +" sucess");
      }
      pdfDocument.close();
      }else

      { System.out.println(pdfPath +" nao existe"); }

      return bImages;
      }

      private static void saveImageToRepository(int i, int j,
      BufferedImage convertedImage) throws IOException

      { File outputfile = new File("C:/Desenvolvimento/bkp/convertido/" + i + j+ ".png"); ImageIO.write(convertedImage, "png", outputfile); }


      I create a list of images
      these images are saved to be loaded in the browser later on a JSF component.

      Thank you!

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              paulocamargomello Paulo R C Mello Junior
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: