Confluence error: "An error occurred while exporting your content to PDF"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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 exporting a Confluence page to PDF, the export process fails with the error "An error occurred while exporting your content to PDF"
Environment
- Confluence 7.4.13
- Plugin: Scroll PDF Exporter for Confluence versions 5.5.4 - 5.7.1 by K15t.
Diagnosis
The following error will appear in atlassian-confluence.log:
2022-04-11 10:36:32,465 ERROR [scroll-pdf-export:thread-4] [scroll.exporter.job.ExportJobRunnable] run Exception during export.
-- url: /plugins/servlet/scroll-pdf/api/exports | traceId: 1d707192e6486891 | userName: someuser | jobId: 22e25487-c257-4017-a2d3-afffe8264927
com.k15t.scroll.exporter.pipeline.ExportException: Failed to convert HTML to PDF.
at com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConverter.apply(HtmlToPdfConverter.java:80)
at com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConverter.apply(HtmlToPdfConverter.java:24)
at java.base/java.util.Optional.map(Optional.java:265)
at com.k15t.scroll.exporter.pipeline.PdfPipeline.export(PdfPipeline.java:184)
at com.k15t.scroll.exporter.job.PdfPipelineDispatcher.dispatch(PdfPipelineDispatcher.java:21)
at com.k15t.scroll.exporter.job.ExportJobRunnable.run(ExportJobRunnable.java:91)
at com.k15t.scroll.exporter.job.context.ServerContextService$ServerContextAwareRunnable.run(ServerContextService.java:167)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConversionException: External conversion failed with exit code '1'. See work directory log for more details. Error message(s) received from conversion process: com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConversionException: Exception during HTML-to-PDF conversion.
at com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConversionProcess.convertExternally(HtmlToPdfConversionProcess.java:364)
at com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConversionProcess.run(HtmlToPdfConversionProcess.java:219)
at com.k15t.scroll.exporter.pipeline.output.HtmlToPdfConverter.apply(HtmlToPdfConverter.java:73)
... 11 more
Cause
A NullPointerException export error is caused when exporting specific heading content, that contains double quotes, with specific export templates. K15t has acknowledged this as a bug in Scroll PDF Exporter for Confluence.
Solution
Per the bug linked here, https://k15t.jira.com/browse/EXP-3423, upgrade Scroll PDF Exporter for Confluence to the next release when available.