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

White page when converting first page to image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.4
    • 2.0.0
    • Rendering
    • None
    • windows

    Description

      When converting first page to image by this code for attached PDF:

      private static BufferedImage computeImage(PDDocument document) throws IOException {
          int imageType = BufferedImage.TYPE_INT_RGB;
      
          int resolution;
          try {
            resolution = Toolkit.getDefaultToolkit().getScreenResolution();
          } catch (HeadlessException e) {
            resolution = 96;
          }
      
          PDPage page = (PDPage) document.getDocumentCatalog().getAllPages().get(0);
          try {
            BufferedImage image = page.convertToImage(imageType, resolution);
            return image;
          } finally {
            page = null;
          }
        }
      

      returned image is the of a white page.

      Attachments

        1. wrongpdf.pdf
          118 kB
          Hong-Thai Nguyen

        Issue Links

          Activity

            People

              Unassigned Unassigned
              thaichat04 Hong-Thai Nguyen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: