This is the documentation for an older version of Scroll PDF Exporter. Here you can view the most up-to-date version of the Scroll PDF Exporter documentation.

Advanced Template Development

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:

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:

  1. Create a template.
  2. Export your Confluence content using that template.
  3. Browse to the Confluence temp directory and check for a directory called something like scroll-pdf-299730148190185278445108969483718 or scrll_PdfExporter895922784782977491811967295134396 (depending on the Scroll PDF Exporter version your are using - the number part will be different).
    (info) Please make sure that the creation time is consistent to the export time, to ensure that you are using the right directory.
  4. Copy this directory to your local machine.
  5. Download the Scroll PDF Exporter OBR-file from the Atlassian Marketplace (download the version you have installed in Confluence).
  6. 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:

  1. 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.

    Note

    Do not change the content of other style tags, as you will not be able to do that in the Template Designer later on.

  2. After you updated the CSS execute the following command to convert your copied PDF exporter working directory to a PDF-file:

    java -cp <SCROLL_PDF_EXPORTER_JAR_FILE> org.xhtmlrenderer.simple.PDFRenderer <PDF_WORKING_DIR_LOCATION>/<CLEANED_*.xhtml> <OUTPUT_PDF>

    For example:

    java -cp scroll-pdf-3.0.10.jar org.xhtmlrenderer.simple.PDFRenderer scroll-pdf-299730148190185278445108969483718/CLEANED_Home.xhtml test.pdf
    • 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.
  3. 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:

  1. 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.
  2. Save the template.