PDF export fails because of a GIF and/or animated GIFs

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

When trying to export a space that has several pages with several images on it, to PDF, the PDF export is crashing causing the export to fail.
PDF export fails on some pages only and crashes. We were able to identify that it only crashes on some very specific pages that have some specific animated GIFs.

Environment

Confluence 7.13.7 with Java 11.0.19+7 and earlier from Eclipse Adoptium (OpenJDK Runtime Environment)


Diagnosis

When performing a space export to PDF, the export may fail and a similar stack trace may be found on application logs.

2023-05-15 15:36:41,707 ERROR [Long running task: PDF Space Export] [core.task.longrunning.AbstractLongRunningTask] lambda$doRunInternal$0 Error during PDF export
 -- url: /spaces/flyingpdf/doflyingpdf.action | traceId: 18b30b8919504a22 | userName: [email] | referer: https://confluence.wizards.com/spaces/flyingpdf/flyingpdf.action?key=DRPG | action: doflyingpdf
com.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document C:\Program Files\Atlassian\Application Data\Confluence\temp\pdfexport-20230515-150523-1206-783\DRPG-150523-1206-784.pdf
    at com.atlassian.confluence.extra.flyingpdf.impl.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:115)
    at com.atlassian.confluence.extra.flyingpdf.impl.InternalPdfExporterService.createPdfForSpace(InternalPdfExporterService.java:86)
    at com.atlassian.confluence.extra.flyingpdf.impl.DelegatingPdfExporterService.createPdfForSpace(DelegatingPdfExporterService.java:49)
    at com.atlassian.confluence.extra.flyingpdf.impl.BigBrotherPdfExporterService.createPdfForSpace(BigBrotherPdfExporterService.java:66)
    at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportLongRunningTask.lambda$doRunInternal$0(PdfExportLongRunningTask.java:92)
    at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
    at com.atlassian.sal.spring.component.SpringHostContextAccessor.lambda$doInTransaction$0(SpringHostContextAccessor.java:70)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
    at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:68)
    at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.access$001(ConfluenceSpringHostContextAccessor.java:21)
    at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.lambda$doInTransaction$3(ConfluenceSpringHostContextAccessor.java:72)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
    at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.doInTransaction(ConfluenceSpringHostContextAccessor.java:72)
    at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
    at jdk.internal.reflect.GeneratedMethodAccessor285.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
    at com.sun.proxy.$Proxy273.execute(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor285.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
    at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
    at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy2538.execute(Unknown Source)
    at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportLongRunningTask.doRunInternal(PdfExportLongRunningTask.java:76)
    at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportSemaphore.run(PdfExportSemaphore.java:28)
    at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportLongRunningTask.runInternal(PdfExportLongRunningTask.java:66)
    at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)
    at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:39)
    at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
    at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)
    at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Failed to read image
    at com.atlassian.confluence.extra.flyingpdf.impl.LightITextFSImage.getImage(LightITextFSImage.java:219)
    at org.xhtmlrenderer.pdf.ITextOutputDevice.drawImage(ITextOutputDevice.java:828)
    at org.xhtmlrenderer.pdf.ITextImageElement.paint(ITextImageElement.java:72)
    at org.xhtmlrenderer.pdf.ITextOutputDevice.paintReplacedElement(ITextOutputDevice.java:199)
    at org.xhtmlrenderer.layout.Layer.paintReplacedElement(Layer.java:540)
    at org.xhtmlrenderer.layout.Layer.paint(Layer.java:306)
    at org.xhtmlrenderer.layout.Layer.paintLayers(Layer.java:165)
    at org.xhtmlrenderer.layout.Layer.paint(Layer.java:337)
    at org.xhtmlrenderer.pdf.ITextRenderer.paintPage(ITextRenderer.java:432)
    at org.xhtmlrenderer.pdf.ITextRenderer.writePDF(ITextRenderer.java:380)
    at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:333)
    at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:265)
    at com.atlassian.confluence.extra.flyingpdf.impl.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:112)
    ... 55 more
Caused by: java.lang.RuntimeException: Failed to read image
    at com.atlassian.confluence.extra.flyingpdf.impl.LightITextFSImage.getImage(LightITextFSImage.java:212)
    ... 67 more
Caused by: java.net.MalformedURLException: no protocol: /download/attachments/218248053/rummaging.gif?version=1&modificationDate=1675100288650&api=v2
    at java.base/java.net.URL.<init>(Unknown Source)
    at java.base/java.net.URL.<init>(Unknown Source)
    at java.base/java.net.URL.<init>(Unknown Source)
    at com.atlassian.confluence.extra.flyingpdf.impl.LightITextFSImage.getImage(LightITextFSImage.java:201)
    ... 67 more



Cause


There seems to be a possible bug with Java Eclipse Adoptium lower than 11.0.19+7. It is possible that other Confluence versions may be affected as well but this has not been tested.

Solution

Upgrade the Java to a version that is equal or greater than 11.0.19+7 


Last modified on Sep 25, 2024

Was this helpful?

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