Apache PDFBox Removes Horizontal Lines When Converting to PNG

j will :

I have a PDF that when I render it to a png it removes the horizontal and vertical lines. This is the PDF and what it should look like: https://drive.google.com/file/d/1sAXwnaoZ-QJn1Kbpw85hhzV_X5zwgfkA/view?usp=sharing

And here is the PNG of the PDF using PDFBox 2.0.13: enter image description here

Why are those lines removed and how can I get them to be rendered in the PNG?

mkl :

The problem (most likely) is that you have no Java ImageIO plugin for the JBIG2 image format installed as the missing lines and headings are actually JBIG2 images.

When I run the PDFBox PDF Debugger without such a plugin and open your PDF in it, it does not display the missing parts either; having added such a plugin to its classpath, it suddenly does display them.

For more details on the PDFBox dependencies please read the PDFBox 2.0 Dependencies page. In particular

JAI Image I/O

PDF supports embedded image files, however support for some formats require third party libraries which are distributed under terms incompatible with the Apache 2.0 license:

These libraries are optional and will be loaded if present on the classpath, otherwise support for these image formats will be disabled and a warning will be logged when an unsupported image is encountered.

Maven dependencies for these components can be found in parent/pom.xml. Change the scope of the components if needed. Please make sure that any third party licenses are suitable for your project.

To include the JBIG2 library the following part can be included in your project pom.xml:

<dependency>
    <groupId>org.apache.pdfbox</groupId>
    <artifactId>jbig2-imageio</artifactId>
    <version>3.0.0</version>
</dependency>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=129512&siteId=1