render - a complex script rendering utility based on pangocairo

This is an experimental python package for generating renderings of complex scripts. This is based on pypdflib and pangocairo.

The module currently has two functions

  • a wiki to pdf generater
  • a complex script renderer

Installation

You will need to have pango and cairo installed on your system along with pycairo. You will probably have them if you have pygtk on your system.

pycairo does not install in virtualenvs,so use you distributions package manger to install pycairo or use pip to install pycairo system wide.

API reference

class render.core.Render[source]

The render class. Instantiate to get access to the methods.

get_info()[source]

returns info on the module

get_module_name()[source]

returns the module name

render_text(text, file_type='png', path=None, filename=None, width=0, height=0, color='Black', font='Serif', font_size=12)[source]
Parameters:
  • text (str.) – the text to be rendered.
  • file_type (str.) – required output format. accepts png, svg and pdf
  • filename (str.) – filename for the output
  • path (str.) – the file path for the output. defaults to the current directory
  • width (int.) – width of the output
  • height (int.) – height of the output
  • color (str.) – the background color for the rendering.
  • font (str.) – the font to be used
  • font_size (int) – font size to be used. defaults to 12
Returns:

the path to the generated rendering.

generates a rendering of the supplied text.

wiki2pdf(url, path=None, font='Serif')[source]
Parameters:
  • url (str.) – the url for the wiki page
  • font (str.) – the font to be used for the pdf.
  • path – output path.Defaults to current dir
Returns:

the path to the generated pdf.

Indices and tables

Table Of Contents

Related Topics

This Page