When developing a template you will quite often find yourself changing something in the template, saving it, then exporting a Confluence page, and finally checking the exported PDF-file.
Usually you will have to repeat these steps multiple times until the template contains the formatting as you want it to be, which will take a lot of time. We thought about a new approach to speed up the template development: Change your CSS local on your machine and upload it once when you finished the CSS and are satisfied with the results. This new approach contains of the following steps:
- In Confluence (once): Preparing the Template and Tools: Initially create a template using the template designer and perform an export using that template.
- On your machine (multiple times): Working on the Template CSS: Do CSS changes, convert to PDF, and check the PDF. Rinse and repeat until the PDF looks fine.
- In Confluence (once): : Copy your CSS changes to the template.
Preparing the Template and Tools
You first have to prepare the template and export your wiki content to your local drive.
To prepare the template and tools:
- Create a template.
- Export your Confluence content using that template.
- Browse to the Confluence
tempdirectory and check for a directory called something like
scrll_PdfExporter895922784782977491811967295134396(depending on the Scroll PDF Exporter version your are using - the number part will be different).
Please make sure that the creation time is consistent to the export time, to ensure that you are using the right directory.
- Copy this directory to your local machine.
- Download the Scroll PDF Exporter OBR-file from the Atlassian Marketplace (download the version you have installed in Confluence).
- Rename the OBR-file to a ZIP-file and unzip this ZIP-file.
In the unzipped folder there is a JAR-file (
scroll-pdf-<VERSION>.jar) which can be used for the next steps.
Working on the Template CSS
You now have to change some CSS rules in the template and check the results in the exported PDF.
To change the CSS:
Open the CLEANED_* HTML-file in the copied working directory and browse to the last <style> tag in the head section.
This tag contains the CSS you entered in the Content Formatting section.
Do not change the content of other style tags, as you will not be able to do that in the Template Designer later on.
After you updated the CSS execute the following command to convert your copied PDF exporter working directory to a PDF-file:
- The first parameter is the location of the CLEANED_* XHTML-file inside the PDF exporter working directory.
- The second parameter is the location and name of the PDF-file that will be generated.
- Check the generated PDF-file and if required repeat steps 1 to 3.
Updating the Template in Confluence
Once you finished your work on the CSS you will need to merge it back to the template in Confluence.
To update the template:
- Copy all CSS rules from the last style tag in the head section of the CLEANED_* XHTML-file and paste them into the box in the Content Formatting section.
- Save the template.