Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-771

PDF 2 Tiff conversion is not happening properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0
    • 1.6.0
    • Swing GUI
    • None
    • software

    Description

      We are trying to convert PDF to Tiff using the below code, the tiff images are not coming well (width is shrinking, please see the attachment of pdf file and converted tiff file).

      PDDocument document = PDDocument.load(pdfFile);
      List<PDPage> pages = document.getDocumentCatalog().getAllPages();
      for (int i = 0; i < pages.size(); i++) {
      PDPage page = (PDPage) pages.get;
      BufferedImage image = page.convertToImage(12, 300);
      // Convert this image to tiff file.
      }

      To overcome this problem I modified below code in 'org.apache.pdfbox.util.operator.pagedrawer.Invoke' to adjust the width and height.
      // My page width is always 2479
      int imageWidth = awtImage.getWidth();
      if(imageWidth > 2479) {
      imageWidth = 2479;
      }
      // My page height is always 3508
      int imageHeight = awtImage.getHeight();
      if(imageHeight > 3508) {
      imageHeight = 3508;
      }
      Now images are coming fine, it is very slow in processing, not even processing 25 pdfs per hour, also it has memory leaks, it uses lot of resources, it is killing other process with OutOfMemory errors.

      Attachments

        1. PAGE000001.tif
          11 kB
          sri vasu
        2. test_.PDF
          977 kB
          sri vasu

        Issue Links

          Activity

            People

              lehmi Andreas Lehmkühler
              srini123 sri vasu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: