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

Particular PDF fails on renderImageWithDPI call

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.32, 3.0.3 PDFBox
    • 2.0.33, 3.0.4 PDFBox, 4.0.0
    • FontBox
    • None

    Description

      Hello,

       

      The pdf attached to this ticket fails in this following test code block I wrote:

       

      try (PDDocument pdDocument = Loader.loadPDF(Path.of("path to test.pdf").toFile())) {
          PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
          for (int page = 1; page <= pdDocument.getNumberOfPages(); page++) {
              pdfRenderer.renderImageWithDPI(page - 1, 300, ImageType.RGB);
          }
      } 

      The error I get is:

      Dec 02, 2024 11:59:23 AM org.apache.pdfbox.rendering.GlyphCache getPathForCharacterCode
      SEVERE: Glyph rendering failed for code 32 in font Arial-BoldMT
      java.io.EOFException: EOF at 108, b1: -1, b2: -1 

      The pdf appears to load fine in the browser for me.

       

      I am using pdfbox 3.0.3:

      implementation("org.apache.pdfbox:pdfbox:3.0.3") 

      I have many other PDFs which are failing in a similar way, but I thought to just include one for now. I can add more if it'll help.

      Attachments

        1. image-2024-12-02-19-52-41-092.png
          7 kB
          Tilman Hausherr
        2. test.pdf
          127 kB
          Noor Khan

        Activity

          People

            tilman Tilman Hausherr
            noordotkhan Noor Khan
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: