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

PDF to Image - unable to display text of PDFs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.9
    • None
    • Rendering
    • None

    Description

      Unable to render text of pdf file to png

      public class PdfToImageRedoTester {
          public static void tester(String filename) throws IOException {
              try(PDDocument document = PDDocument.load(filename + ".pdf")) {
                  //PDDocument.load(inputStream);
                  List<PDPage> list = document.getDocumentCatalog().getAllPages();
                  PDPage page = list.get(0);
                  BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, 300);// DEFAULT_IMAGE_RESOLUTION);// 200);
      
                  File outputfile = new File(filename + ".png");
                  System.out.println("Image Created -> " + outputfile.getName());
                  ImageIO.write(image, "png", outputfile);
                  image.flush();
              }
          }
      
          public static void main(String[] args) throws IOException {
              String fileName = "C:\\temp\\332_4";
              tester(fileName);
      
          }
      }
      

      https://smartfin.awsapps.com/workdocs/index.html#/document/a421dad8d4a870d8220ce7c3c8f07b94035d172eb17e1150e8ae44a6a3fb5f13
      https://smartfin.awsapps.com/workdocs/index.html#/document/c190a8684c1482713bcf708f2b79ea447ed3720f21da31ffe5e82e35bdfb2fb0

      Attachments

        1. 332_4.png
          1.52 MB
          Lori
        2. 332_4.pdf
          114 kB
          Lori
        3. 313_4.png
          139 kB
          Lori
        4. 313_4.pdf
          82 kB
          Lori

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lori.golden Lori
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: