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

PDFRenderer adding horizental white lines to exported image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.0.15
    • None
    • Rendering
    • None

    Description

      Hello,

      I started using pdfbox recently to extract a datamatrix code from a pdf file.

      The image extraction works pretty fine.

      We found out that the source of the pdfs is not attaching them neither as embedded objects or inline image, the datamatrix is coded in the pdf as black squares.

      Then, the idea was to convert the pdf to an image and parse the code.

      Only problem, the conversion sometimes add white lines inside the datamatrix which makes the it unparsable (see attachements page-3-1.jpeg and page-3.pdf)

      For some other cases, the datamatrix squares differ in size in the exported image while they are the same in the original pdf file (see attachements page-7.jpeg and page-7-1.pdf).

      The outcome is the same and the parser is not able to recognize the datamatrix content.

      The code I am using to convert to BufferedImage is pretty straightforward

                      BufferedImage bi = new PDFRenderer(pdDocument).renderImageWithDPI(i, 600, ImageType.BINARY);
      

       

       

      Is it the way I am using the renderer which causing this problem or simply a bug in the software!

       

      I am attaching the test project reproducing the behavior.

       

      Attachments

        1. PdfBoxTestCase.zip
          717 kB
          amiladi
        2. page-3-1.jpeg
          338 kB
          amiladi
        3. page-7-1.jpeg
          389 kB
          amiladi
        4. page-7.pdf
          150 kB
          amiladi
        5. page-3.pdf
          132 kB
          amiladi

        Issue Links

          Activity

            People

              Unassigned Unassigned
              amiladi amiladi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: