PDF macro failed to generate the thumbnail image
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
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
1
2
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.
Solution
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
Open the setevn.sh from the Confluence installation folder
Add the below line:
setenv.sh
1
CATALINA_OPTS="-Dpdf.render.memory.guard.disabled=true ${CATALINA_OPTS}"
Restart Confluence
Navigate to the page, delete the original attachment to clear the corrupted thumbnail
Re-attach it to the page
Add the PDF macro to the page
In Windows, with Confluence running as a service
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
Open the command window (Choose Start > cmd.exe)
cd to the bin directory of your Confluence installation folder and run the following command:
1
tomcat9w.exe //ES//%service_name%
Click on the Java tab to see the list of current start-up options
In the Java Options box, add:
1
-Dpdf.render.memory.guard.disabled=true
Restart the service
For more details, please refer to Configuring System Properties - Windows service
Navigate to the page, delete the original attachment to clear the corrupted thumbnail
Re-attach it to the page
Add the PDF macro to the page
Was this helpful?