As one of best practices for business continuity planning (BCP), your team might want to export a whole space to PDF. However, some of Confluence page possibly contain invalid data and they block PDF export due to unrecoverable exceptions.
I'll introduce some diagnosis approaches to identify which page is causing the export unavailability.
Here's the way to identify the problematic page. Note that this is only applicable for Confluence Server and not for Confluence Cloud.
This setting makes Confluence to output the helpful logs to identify the problematic page like below:
DEBUG [Long running task: PDF Space Export] [extra.flyingpdf.html.RenderedXhtmlBuilder] renderToHtml Rendering to exported XHTML page id=___PAGE_ID__ (__PAGE_TITLE__)
Here's another way to identify the problematic page. It's time-consuming but applicable for both Confluence Server and Confluence Cloud. Basically, you need to export all the pages in the target space one-by-one so that the pages containing invalid data complain error.
#!/bin/bash
# Usage:
# chmod u+x ./snippet.sh
# bash ./snippet.sh
# Advisory for Atlassian Cloud
# Despite of using your password, you should generate an API token at https://id.atlassian.com/manage/api-tokens for calling APIs.
C_SCHEME="https"
C_HOST="example.com:8090"
C_USER="admin"
C_PASSWORD=""
TARGET_SPACE="SP"
curl -u ${C_USER}:${C_PASSWORD} -sG "${C_SCHEME}://${C_HOST}/rest/api/content/search" --data-urlencode "cql=(type in (page, blogpost) and space in (${TARGET_SPACE}))" \
| jq .results[]?.id \
| xargs -I{} echo "${C_SCHEME}://${C_HOST}/spaces/flyingpdf/pdfpageexport.action?pageId={}"
To open multiple URLs at once, adopt these extensions if needed.
If you are system admin of Confluence Server, you also can run the query below to list up page IDs in the target space.
select contentid from content c
join spaces s
on s.spacekey in ('SP')
and c.spaceid = s.spaceid
and c.contenttype in ('PAGE', 'BLOGPOST')
K_ Yamamoto
Technical Support Engineer
Atlassian, K.K.
Yokohama, Japan
10 accepted answers
0 comments