« Home

Workflows & Techniques

Twine to PDF

The simplest workflow is to go directly from Twine to a PDF as explained on the home page. This is a one-way workflow. You export your game from Twine (either by using the normal "Save a Copy" function, or using a story format such as Twison or Entweedke), load it into Gordian, and then produce the PDF. In this workflow, passages are numbered once, when the game is first converted. Converting again would change the numbering, so each time you make changes in Twine and re-export you will get a different order. This is especially relevant to page breaks, and the placement of images.

Twine to Twine

Once exported from Twine to Gordian, you can export from Gordian back to Twine, using the Export Twine Archive link. Then, in Twine, choose Import From File to re-import your story. Note that, unless you rename your story in Gordian (or in the exported file) first, it will entirely replace the story you have in Twine. Be careful.

Twine to Twee

Once exported from Twine to Gordian, you can export from Gordian to Twee3, a human-readable format for interactive fiction. Gordian uses tags to number the paragraphs in Twee, and includes your custom settings and covers in special passages (such as gb-front-cover, and gb-settings). You should be able to export from Gordian to Twee, and then re-import that Twee and get the same results.

If you should want to get your Twee file back into Twine (e.g. after spell-checking it, or working on it in a text editor), you will need to use tweego to convert the Twee to a Twine archive.

tweego -a -o archive.html exported.twee

Then import the archive into Twine. Note that this will replace your existing game unless you rename the game in the twee file first.

PDF Formatting

PDFs are created using MPDF. You can read the manual to find special tags (such as page breaks, headers, and footers) that you can include in your gb-introduction or other passages.

Passage order

When you convert your game with Gordian, your passages are randomly ordered and numbered. Sometimes this will result in awkward juxtapositions of passages (a choice followed immediately on the same page by the result), or unsightly gaps in the PDF where passages don't fit very well. While you can convert multiple times to get an order you like, there will inevitably come a stage where you just wish to tweak the exact placement of certain passages.

By default, passages will not run over multiple pages (unless they are longer than a full page), and may leave gaps. You can add the long tag to a passage to allow it to break. If this doesn't fix your issues, you can swap the position of individual passages using the Edit Passage link. Bring up the passage you want to move and use the Change number box to swap it with another passage that will fill the page better. You can check how your alterations affect individual pages by using the page range link to display just the page in question.

Images

If you wish to include images in your PDF, you will need to place them online and use absolute paths to include them in your game, otherwise MPDF will not be able to import them.

Getting image placement correct can take some trial and error - since Gordian does not allow you to reposition images directly in your PDF. First import and convert the game, then look at the PDF to see where your images would sit best. Then edit individual passages in Gordian to add the images to them. If you need to absoloutely place images on the page, they cannot be contained in a passage (this is a limitation of MPDF, which we use to produce the PDF). To deal with this, place the image in an <after> tag to place it outside the passage container. When you do this, make sure to give your image an id, so that you can target it in your custom CSS.

When adding images to an existing game you may wish to fill gaps in the PDF with small 'cut' images (in the style of Fighting Fantasy games). A handy way to do this is to use the page range link to display just the page in question, and then expiriment with adding images to fill up the space.

Covers

If you enable covers in settings, GBF will add a front cover page to your PDF containing the game title. This ends with a page break and resets page numbering (so the first page after the title is page 1). If you provide a passage named gb-front-cover then this will override the automatic cover. Gordian provides some utility classes to help lay out your cover as follows:

Note that, due to restrictions in MPDF, nested elements cannot be absolutely positioned, and you cannot use descendent selectors in CSS to target the immediate children of an absolutely positioned element. So, in the example below, you cannot style the title with .cover_top .cover_title, you must use just .cover_title

<div class='cover_top'> <h1 class='cover_title'>Book Name</h1> </div> <div class='cover_image'></div> <div class='cover_bottom'> <h2>By<br>N. N. Author</h2> </div>

Custom CSS

Custom CSS can be entered in the Settings. In addition, any User Stylesheet created in Twine, or any passage tagged stylesheet will be appended to the CSS from settings.