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

PDF Page Render Background Image has Gray Smudges

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.17
    • 2.0.18, 3.0.0 PDFBox
    • Rendering
    • None

    Description

      The following text produces a PNG that has gray smudges in it.  I've attached the pdf and the PNG that is produced.

       

      public class TestPdfPageImage {
      
          @Test
          public void testGetPageImage() throws IOException {
              try (PDDocument pdDocument = PDDocument.load(FileUtils.toFile(getClass().getResource("/bad_page_image.pdf")))) {
                  final PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
      
                  final BufferedImage bufferedImage = pdfRenderer.renderImage(0);
                  final Path tempPath = Files.createTempFile("es-page-image", ".png");
                  try {
                      final File tempFile = tempPath.toFile();
                      ImageIO.write(bufferedImage, "png", tempFile);
      
                      Assert.assertTrue(Files.size(tempPath) > 0);
                  } finally {
                      Files.delete(tempPath);
                  }
              }
          }
      }
      

      Attachments

        1. es-page-image2455431271065294360.png
          343 kB
          Joseph Jezerinac
        2. bad_page_image.pdf
          3.73 MB
          Joseph Jezerinac

        Activity

          People

            tilman Tilman Hausherr
            jezerinac Joseph Jezerinac
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: