Converting a narrative to PDFļƒ

This documentation will walk through how to turn a narrative into a static PDF. We understand that there are multiple reasons why PDFs may be a necessary method of distribution, but stress that narratives are designed to be viewed through auspice where you have the ability to interact with and interrogate the data.

If you run into any bugs, please get in contact with us.

Prerequisitesļƒ

This requires Decktape to be installed, which itself requires Node.js. If youā€™ve followed the auspice install instructions and are using a conda environment then this is straightforward. If not, you can create the necessary conda environment via:

conda create --name auspice nodejs=14

Install Decktape via:

conda activate auspice # or whichever conda environment has nodejs
npm install --global decktape

Saving an online narrative to PDFļƒ

Letā€™s say we want to save the example Genomic-Epi Situation Report for Ebola in the DRC available at nextstrain.org/narratives/inrb-ebola-example-sit-rep which you can see has 6 different ā€œpagesā€ of content. We use decktape to access these different pages & save their output as PDF via:

decktape generic --load-pause 3000 --key ArrowDown --size 1600x900 \
  https://nextstrain.org/narratives/inrb-ebola-example-sit-rep example.pdf

Youā€™ll see a lot of bad-looking warning messages printed in the terminal šŸ˜±, but as long as you see ā€œPrinted 7 slidesā€ or similar then the command has worked. You should now be able to view a static PDF of the narrative, in this case at example.pdf. Feel free to play around with the different options available to decktape (run decktape generic --help to see them).

Note that this technique wonā€™t work if authentication is required. Please refer to the section on saving local narratives to PDF for how to do this.

Saving a local narrative to PDFļƒ

If you have a local narrative then the concept is similar to saving an online narrative, except we need to start a auspice server locally to display our narrative & allow it to be accessed by decktape. These instructions assume you have installed auspice into a conda enviornment as per the auspice install instructions.

Start up auspice locally, sourcing your own datasets & narratives via:

conda activate auspice # or whichever conda environment has auspice installed
auspice view --datasetDir <path-to-datasets> --narrativeDir <path-to-narratives>

You should now be able to view your narrative at localhost:4000. For the purposes of this guide, iā€™ll assume that weā€™ve followed the Writing a Narrative guide, and thus have a narrative describing mumps in North America available at localhost:4000/narratives/example.

In a separate terminal window, run

conda activate auspice # or whichever conda environment has dectape installed from earlier
decktape generic --load-pause 3000 --key ArrowDown --size 1600x900 \
  http://localhost:4000/narratives/example example.pdf

Youā€™ll see a lot of bad-looking warning messages printed in the terminal šŸ˜±, but as long as you see ā€œPrinted 11 slidesā€ or similar then the command has worked. You should now be able to view a static PDF of the narrative, in this case at example.pdf.