PDF macro failed to generate the thumbnail image

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Summary

Scanned PDF document that consists a single embedded image won't be displayed correctly in PDF macro on the Confluence page. However, PDF preview works as expected.

Environment

  • Scanned PDF

Diagnosis

The following message appears in the atlassian-confluence.log, when the PDF file view macro attempted to generate the thumbnail image and failed:

atlassian-confluence.log
WARN [DefaultSlideCacheManager:thread-1] [conversion.convert.image.MemoryAwarePDFRenderer] drawImage Image of size 1656*2339 px dropped for memory protection
 -- referer: http://localhost:8090/confluence/display/ct/testpage | url: /confluence/plugins/servlet/pptslide | traceId: a6c6cd1339882b25 | userName: admin

Cause

Image rendering takes an amount of memory and sometimes make the Confluence instance crash. To prevent the problem, Confluence then applied memory protection by design.

Workarounds

Option One (Preferred)

Convert the scanned documents into JPEG or PNG format instead of PDF.

Option Two

Please do take note that by performing this workaround and disabling the memory guard, you may hit into OutOfMemoryErrors if a high-resolution image is embedded in a PDF.

In Linux

  1. Open the setevn.sh from the Confluence installation folder 
  2. Add the below line: 

    setenv.sh
    CATALINA_OPTS="-Dpdf.render.memory.guard.disabled=true ${CATALINA_OPTS}"
  3. Restart Confluence
  4. Navigate to the page, delete the original attachment to clear the corrupted thumbnail
  5. Re-attach it to the page
  6. Add the PDF macro to the page

In Windows, with Confluence running as a service

  1. Identify the name of the service that Confluence is installed as in Windows (Go to Control Panel > Administrative Tools > Services

    We are expecting to see a service name like this Confluence251017164028

  2. Open the command window (Choose Start > cmd.exe)
  3. cd to the bin directory of your Confluence installation folder and run the following command: 

    tomcat9w.exe //ES//%service_name%
  4. Click on the Java tab to see the list of current start-up options
  5. In the Java Options box, add: 

    -Dpdf.render.memory.guard.disabled=true
  6. Restart the service 

    For more details, please refer to Configuring System Properties - Windows service

  7. Navigate to the page, delete the original attachment to clear the corrupted thumbnail
  8. Re-attach it to the page
  9. Add the PDF macro to the page

Last modified on Sep 20, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.