rst2pdf is going to be one day late. But there's a good reason.

Besides everything I mentioned yesterday, today I implemented two rather important features: cascading stylesheets, and user-defined page layouts. Here is a screenshot:

montecristo-3

That neat two-column layout is done by adding this to the stylesheet:

"pageTemplates" : {
  "firstPage": {
      "frames": [
          ["0cm", "0cm", "49%", "100%"],
          ["51%", "0cm", "49%", "100%"]
      ]
  }
},

The name "firstPage" is magical right now, and there's no way to change from one template to another (yet), and until I do that, I won't be releasing.

Here's what cascading stylesheets does. Suppose you want to use A5 paper and size 12 Times New Roman fonts? Here's all the stylesheet you need:

{
  "pageSetup" : {
    "size": "A5",
  },
  "fontsAlias" : {
    "stdFont": "Times-Roman",
  },
  "styles" : [
    ["base" , {
      "fontSize": 14,
      "leading": 16
    }]
  ]
}

Also, you can specify as many stylesheets as you want in the command line. So you can have one that sets the paper size, one for page layout as above, one for font "sets", etc.

Neat, isn't it?

Comments

Comments powered by Disqus