Legacy Knowledge Base
Published Jul. 2, 2025

Preventing Inaccurate or Incomplete PDF Document Previews

Written By

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

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:

  1. The version of PDF Document.

    The versions where this issue is observed is version 1.4, 1.5, 1.6, and 1.7.

  2. 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:

  1. 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.
  2. Version of the PDF document 1.7 and any font encoding. The result is that previews are generated with no text and without images.

Resolution

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.

Did this article resolve your issue ?

Legacy Knowledge Base