This article is a legacy article. It applies to previous versions of the Liferay product. While the article is no longer maintained, the information may still be applicable.
Generating Previews of PDF Documents using PDFBox can lead to the generation of incomplete or inaccurate results, such as previews without text or images.
This is due to these variables:
- The version of PDF Document.
The versions where this issue is observed is version 1.4, 1.5, 1.6, and 1.7.
- The Font Encoding.
The font encodings (whether embedded or unembedded): “WinAnsi”, “Custom”, and “Identity-H”
For instance, issues were encountered when using the below combinations:
- Version of PDF Document 1.4, 1.5, or 1.6 and font encoding “Custom” and/or “Identity-H.” The result is that previews are generated incorrectly with no text.
- Version of the PDF document 1.7 and any font encoding. The result is that previews are generated with no text and without images.
The resolution for this issue is to configure Liferay to use ImageMagick + Ghostscript to generate previews of PDF Documents. In our tests, ImageMagick version 6.7.7-10 and Ghostscript version 9.14 were used. Here you can find instructions to configure Liferay to use ImageMagick and Ghostscript.
The result of these combinations is that PDF Document previews are generated correctly regardless of the Font Encoding.