--- layout: post title: "CaSSius: a PDF typesetter using CSS regions (via polyfill)" categories: [PDF, typesetting, XML] tags: [typesetter, PDF, OLH] published: True image: feature: CaSSius.png --- ![CaSSiuS](/images/CaSSius.png) Announcing [CaSSius](https://github.com/MartinPaulEve/CaSSius): a tool to create beautiful paginated PDF documents from HTML content using CSS regions. It is intended to be part of [XML-first/XML-in workflows](https://www.martineve.com/2015/07/20/building-a-real-xml-first-workflow-for-scholarly-typesetting/) for scholarly communications but may have alternative uses. CaSSius: heavyweight typesetting with lightweight technology. #Usage and Quick Start Guide CaSSius takes standard HTML content in a pre-specified form and flows it between CSS regions (see "document structure" below). To begin using CaSSius follow these steps: 1. Move or copy the "cassius" directory from this repository into the root of your website. 2. Insert the following code into the head tag of your HTML document: 3. Optionally, insert the javascript code for [Adobe typekit](https://typekit.com) (you will need to sign up for an account). 4. Format your document according to the "document structure" guide below. 5. Replace cassius/images/logo.png with your own logo. 6. Load the page in a browser, wait until it has finished typesetting and then use the browser's "print to PDF" option to create your document. #Document Structure The following rules should be strictly adhered to in order to produce correct documents. Every HTML file should contain a CaSSius metadata block. A CaSSius metadata block should be wrapped inside a script tag with type set to "text/cassius" and an id attribute of "cassius-metadata. A CaSSius metadata block may contain the following elements: If the "cassius-title" metadata div is not present, CaSSius will use the HTML document's "title" element in the "head" of the document. The basic structure of a CaSSius document is as follows (also available in [template.html](https://github.com/MartinPaulEve/CaSSius/blob/master/template.html)):

Abstract

Your abstract content here.

As many paragraphs as needed.

© 2015 Martin Paul Eve. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

A section title

A paragraph.

A section title

A paragraph with a footnote.1

Notes

1 Footnote content goes here.

References

  • Adorno, Theodor W., Negative Dialectics, trans. by E.B. Ashton (London: Routledge, 1973)
#Import from JATS/NLM An early-stage version of an import function from JATS is implemented in [cassius-import/bin/cassius-import.py](https://github.com/MartinPaulEve/CaSSius/blob/master/cassius-import/bin/cassius-import.py). This script requires python and java. Usage: cassius-import.py [options] cassius-import.py (-h | --help) cassius-import.py --version A sample XML file to show this working (and the scope of implementation to date) [can be found in the cassius-import directory](https://github.com/MartinPaulEve/CaSSius/blob/master/cassius-import/sample.xml). #Performance and Settings If you are consistently typesetting documents that are over fifty pages long, you may see a performance increase if you change the value of initialPages to a higher setting in cassius.js. Setting this to a higher value will yield better performance on larger documents, but worse performance on smaller documents. #Components and Licensing CaSSius is copyright Martin Paul Eve 2015. It is released under the terms specified in [LICENSE](https://github.com/MartinPaulEve/CaSSius/blob/master/LICENSE). CaSSius makes use of several other open-source/free-software projects, including: * [css-regions-polyfill](https://github.com/FremyCompany/css-regions-polyfill). Copyright (c) 2014 François REMY with [a BSD-style license](https://github.com/FremyCompany/css-regions-polyfill/blob/master/LICENSE.md). * [jQuery](https://jquery.org). Under [the MIT license](https://jquery.org/license/). * The CaSSius logo is a derivative of a work by [Lil Squid from the Noun Project](https://thenounproject.com/search/?q=type&i=150037), licensed under the Creative Commons Attribution License. * Parts of the cassius-import library contain materials from the National Library of Medicine, specifically [adaptations of their XSLT suite and entity resolution files, which are public domain](http://dtd.nlm.nih.gov/tools/tools.html). * The cassius-import library links to the Saxon XSLT and XQuery Processor from Saxonica Limited which is dual-licensed under the GNU GPL and the Mozilla Public License . This dual-licensing applies ONLY to the file saxon9.jar.