Create PDFs from Jira and Confluence
Our product documentation is split between Jira tickets and Conflunce Wiki pages. We were looking for a single tool to export PDFs from these two Atlassian tools.
Not finding anything that met our requirements, we developed smithmicro/pdf
to help us create both internal and customer documentation. Here are our initial requirements that this tool inspired:
- Create PDF files from Confluence and Jira - Data Center versions
- Support username/password authentication with both tools
- Command Line Interface (CLI) for easy automation
- Mimimal Docker image that can be run anywhere
- Adjustable paper sizes and margins
Here is a simple use case creating a PDF from Google:
docker run --init -v $PWD:/output smithmicro/pdf https://www.google.com
You will see a message saying that the program did not detect either Jira or Confluence which will bypass authectication. To create a PDF of JIRA page, use:
docker run --init -v $PWD:/output -e ATL_USERNAME=myusername -e ATL_PASSWORD=mypassword smithmicro/pdf https://jira.mydomain.com/browse/PROJ-1
Or Confluence:
docker run --init -v $PWD:/output -e ATL_USERNAME=myusername -e ATL_PASSWORD=mypassword smithmicro/pdf https://wiki.mydomain.com/display/SPACE/Page+Name
The following required and optional environment variables are supported:
Variable | Required | Default | Notes |
---|---|---|---|
ATL_USERNAME | Yes | None | Atlassian Username |
ATL_PASSWORD | Yes | None | Atlassian Password |
PAPER_FORMAT | No | Letter | See supported paper formats: https://pptr.dev/api/puppeteer.paperformat |
PAPER_MARGIN | No | 50px | Margins used for Confluence printing. Jira uses 0 margins as this looks great. |
TZ | No | America/New_York | Time zone used by Chromium. |
One drawback of using the priting system to generate PDFs from Jira is that it can complain about the client time zone. If you see this message, you will need to adjust the TZ
environment variable.
Your computer's time zone does not match your Jira time zone preference of (GMT-08:00) Los Angeles. Update your Jira preference
Conflunce does not have a similar check during print rendering.
We have only tested the following:
- Confluence 7.13.7 - Data Center
- Jira 8.20.8 - Data Center
Note: We are looking for help from the community to help us support a broader set of versions. Pull requests welcome.
This image is built on top of Puppeteer and Chromium. The goal of this image is to let Puppeteer do what it does best and install the supported version of Chromium as described here. This image is based on the offcial Docker image node:14-slim
as Puppeteer follows the latest maintenance LTS version of Node.
Many Puppeteer Docker images install an init package such as tini or dumb-init. Since Docker has included tini
since early versions, we recommend the use of the --init
CLI switch to achive the same thing.
The main :latest
tag uses node:14-slim
as a base image, however Zenika/alpine-chrome has an excellent set of Docker images for Chromium on Alpine including one with-puppeteer
. The alpine variant using can be found in Dockerfile-alpine
.