0

I want to use ghost4j convert pdf to image. I trying to use PDFDocument.extract to split PDFDcoument and multi thread to convert image. My PDF had some signature content like this picture. (https://i.stack.imgur.com/ydHiE.jpg)

I found only the pdf background will be extract and my renderer image only the pdf content without the signature image.

I had read this question.

Ghost4J native library to convert pdf to image

I also read the ghost4j web site. In my known, the PDFConverter class is build pdf not convert pdf to image. Is my acknowledge is correct or something I was wrong.

Here is my current code.

        PDFDocument document = new PDFDocument();
        document.load(file);
        PDFDocument page = (PDFDocument) document.extract(1, 1);
        SimpleRenderer renderer = new SimpleRenderer();
        renderer.setResolution(96);
        List<Image> images = renderer.render(page, 0, 0);
        for (int j = 0; j < images.size(); j++) {
            ImageIO.write((RenderedImage) images.get(j), "PNG", new File(outputPath + "-" + (j + 1) + "." + "png"));
        }
Ziv
  • 11
  • 4
  • Did you ever get Ghost4J library working to extract images/convert pdf to images? I have this issue: https://stackoverflow.com/questions/61872881/java-convert-pdf-to-image-using-ghost4j – 2one May 18 '20 at 15:18
  • No, I am using another library to convert pdf image currently. I'm current using Aspose Java. (https://www.aspose.com/) After this issue, I get a performance issue. Ghost4j convert large pdf to image is very slowly (1500+ pages). – Ziv Jun 07 '20 at 13:51

0 Answers0