NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Summary

      A single corrupted PNG could lead to failed export to PDF

      Environment

      • Confluence Server
      • Confluence Cloud

      Steps to Reproduce

      1. Obtain sample corrupted PNG from this ticket
      2. Create a new page in Confluence
      3. Add the PNG obtained from step 1 into the page
      4. Save the page
      5. Page tools > Export to PDF

      Expected Results

      1. PDF is successfully exported
      2. Provide a clear error log on which image that the export had failed in

      Actual Results

      The export to PDF failed, and the "System Error" page is returned with the following logs displayed:

      Cause
      com.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document /data/jirastudio/confluence/j2ee_confluence_b3d0eed175f83dcecff9/home/temp/pdfexport-20160602-020616-2352-5/MTS-test1-020616-2352-6.pdf
          at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:102)
      caused by: java.lang.RuntimeException: Failed to read image
          at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.getImage(LightITextFSImage.java:128)
      caused by: java.io.IOException: Corrupted PNG file.
          at com.lowagie.text.pdf.codec.PngImage.readPng(Unknown Source)
      

      The stacktrace from the atlassian-confluence.log does not yield any more information:

       -- referer: http://localhost:15100/confluence/pages/editpage.action?pageId=557060 | url: /confluence/rest/api/content/557060 | traceId: 22fc8a2e783d1cda | userName: admin
      2016-06-03 02:52:00,447 ERROR [http-nio-15100-exec-9] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
       -- url: /confluence/spaces/flyingpdf/pdfpageexport.action | traceId: 80b8fc1c6e6a9db8 | userName: admin | referer: http://localhost:15100/confluence/display/FT/aoshdasdh
      com.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document C:\confluence\Data\confluence_5.10.0EAP\temp\pdfexport-20160603-030616-0251-2\FT-aoshdasdh-030616-0251-3.pdf
      	at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:102)
      	at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:49)
      	... 350 more
      Caused by: java.io.IOException: Corrupted PNG file.
      	... 360 more
      

      Workaround

      Identify the corrupted PNG file and delete it from the page

            [CONFSERVER-42769] Export to PDF failed because of certain corrupted PNG

            Minh Tran added a comment - - edited

            A fix for this issue is available to Server and Data Center customers in Confluence 6.13.0
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Minh Tran added a comment - - edited A fix for this issue is available to Server and Data Center customers in Confluence 6.13.0 Upgrade now or check out the Release Notes to see what other issues are resolved.

            Just had the same problem, more or less:

            com.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document /data/confluence/temp/pdfexport-20180808-080818-0850-985/CT-080818-0850-986.pdfcom.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document /data/confluence/temp/pdfexport-20180808-080818-0850-985/CT-080818-0850-986.pdf at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:104) at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerPdfExporterService.createPdfForSpace(FlyingSaucerPdfExporterService.java:66) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask$1.doInTransactionWithoutResult(PdfExportLongRunningTask.java:92) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.doRunInternal(PdfExportLongRunningTask.java:74) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.runInternal(PdfExportLongRunningTask.java:59) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52) 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:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)Caused by: java.lang.RuntimeException: Failed to read image at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.getImage(LightITextFSImage.java:247) 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.paintReplacedElements(Layer.java:497) at org.xhtmlrenderer.layout.Layer.paintAsLayer(Layer.java:471) at org.xhtmlrenderer.render.BlockBox.paintInline(BlockBox.java:265) at org.xhtmlrenderer.layout.Layer.paintInlineContent(Layer.java:274) at org.xhtmlrenderer.layout.Layer.paint(Layer.java:332) 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.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:93) ... 19 moreCaused by: java.lang.RuntimeException: Failed to read image at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.getImage(LightITextFSImage.java:216) ... 33 more
            

            This seems to be unrecoverable, and the space un-exportable, without finding the image file in question, which is impossible find cause there's no indication in the log where it is. =/

            I would say given that it's a major blocker, this ticket should perhaps be higher-priority than it is.

            Liviu Constantinescu added a comment - Just had the same problem, more or less: com.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document /data/confluence/temp/pdfexport-20180808-080818-0850-985/CT-080818-0850-986.pdfcom.atlassian.confluence.importexport.ImportExportException: Exception while rendering the PDF document /data/confluence/temp/pdfexport-20180808-080818-0850-985/CT-080818-0850-986.pdf at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:104) at com.atlassian.confluence.extra.flyingpdf.FlyingSaucerPdfExporterService.createPdfForSpace(FlyingSaucerPdfExporterService.java:66) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask$1.doInTransactionWithoutResult(PdfExportLongRunningTask.java:92) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.doRunInternal(PdfExportLongRunningTask.java:74) at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.runInternal(PdfExportLongRunningTask.java:59) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52) 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:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748)Caused by: java.lang.RuntimeException: Failed to read image at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.getImage(LightITextFSImage.java:247) 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.paintReplacedElements(Layer.java:497) at org.xhtmlrenderer.layout.Layer.paintAsLayer(Layer.java:471) at org.xhtmlrenderer.render.BlockBox.paintInline(BlockBox.java:265) at org.xhtmlrenderer.layout.Layer.paintInlineContent(Layer.java:274) at org.xhtmlrenderer.layout.Layer.paint(Layer.java:332) 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.FlyingSaucerXmlToPdfConverter.convertXhtmlToPdf(FlyingSaucerXmlToPdfConverter.java:93) ... 19 moreCaused by: java.lang.RuntimeException: Failed to read image at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.getImage(LightITextFSImage.java:216) ... 33 more This seems to be unrecoverable, and the space un-exportable, without finding the image file in question, which is impossible find cause there's no indication in the log where it is. =/ I would say given that it's a major blocker, this ticket should perhaps be higher-priority than it is.

              Unassigned Unassigned
              mkhairuliana Monique Khairuliana (Inactive)
              Affected customers:
              3 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: