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

White areas are rendered red when converting a pdf to png with pdfbox

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.26, 3.0.0 PDFBox
    • None
    • Rendering
    • None

    Description

      hi

      This may be a problem similar to PDFBOX-4470 Red areas around text when converting a pdf to png with pdfbox - ASF JIRA (apache.org)

      When I convert a pdf to png files with pdfbox, I find that the backgroud White color was rendered as Red. And this is unusual, I have only one pdf rendered like this. But in this pdf, almost all pages are rendered as Red color.

      Here's some of the code that I'm using:

      try (PDDocument document = PDDocument.load(new File("example/" + file + ".pdf"))) {
          int numberOfPages = document.getNumberOfPages();
          PDFRenderer renderer = new PDFRenderer(document);
          for (int i = 0; i < numberOfPages; i++) {
              System.out.println("render " + i);
              BufferedImage bufferedImage = renderer.renderImage(i, 2, ImageType.RGB);
              ImageIO.write(bufferedImage, "png", new File("example/" + file + "-" + i + ".png"));
          }
      } 

      I also tried pdfbox 3.0.0-RC1, but result is the same.

      The red png files start at pdf page 3.

      Attachments

        1. err1.pdf
          1.93 MB
          Kirovj
        2. err1-1.png
          132 kB
          Kirovj
        3. err1-2.png
          1.46 MB
          Kirovj
        4. err1-3.png
          549 kB
          Kirovj

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: