diagrams-pdf: PDF backend for diagrams drawing EDSL

[ bsd3, graphics, library ] [ Propose Tags ] [ Report a vulnerability ]

This package provides a modular backend for rendering diagrams created with the diagrams EDSL to PDF files. It uses HPDF making it suitable for use on any platform.

It is a very preliminary version where only the diagrams Logo generation has been tested.

The package provides the following modules:

Additional documentation can be found in the README file distributed with the source tarball


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0, 0.3, 0.3.1
Change log CHANGES.md
Dependencies base (>=4.6 && <4.8), cmdargs (>=0.10 && <0.11), colour (>=2.3.3 && <2.4), diagrams-core (>=0.7 && <0.8), diagrams-lib (>=0.7 && <0.8), filepath (>=1.3 && <1.4), HPDF (>=1.4.5 && <1.5), monoid-extras (>=0.3 && <0.4), mtl (>=2.1 && <2.2), semigroups (>=0.9.2 && <0.10), split (>=0.2.2 && <0.3), vector-space (>=0.8.6 && <0.9) [details]
Tested with ghc ==7.6.3
License BSD-3-Clause
Copyright 2013, alpheccar.org
Author alpheccar
Maintainer misc@alpheccar.org
Category Graphics
Home page http://www.alpheccar.org
Bug tracker http://github.com/alpheccar/diagrams-pdf/issues
Source repo head: git clone http://github.com/alpheccar/diagrams-pdf
Uploaded by alpheccar at 2013-08-19T06:54:54Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3498 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for diagrams-pdf-0.1.0.0

[back to package description]

diagrams-pdf is a an HPDF backend for diagrams. Diagrams is a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language.

diagrams-pdf is a work in progress, and some features are not implemented yet. However, it is functional enough.

Installation

cabal update && cabal install diagrams-pdf

Usage

A simple example that uses diagrams-pdf to draw a square.

import Diagrams.Prelude
import Diagrams.Backend.Pdf.CmdLine

b1 = square 20 # lw 0.002

main = defaultMain (pad 1.1 b1)

Save this to file named Square.hs and compile this program:

ghc --make Square.hs

This will generate an executable which, when run produces a Pdf file. Run the executable with the --help option to find out more about how to call it.

$ ./Square --help
Command-line diagram generation.

Square [OPTIONS]

Common flags:
  -w --width=INT    Desired width of the output image (default 400)
  -h --height=INT   Desired height of the output image (default 400)
  -o --output=FILE  Output file
  -c --compressed   Compressed PDF file
  -? --help         Display help message
  -V --version      Print version information

You must pass an output file name with a .pdf extension to generate the PDF file.

$ ./Square -o square.pdf

Limitations

Two goals of the HPDF library were : powerful typesetting and no dependence on the OS libraries (for better portability). But, HPDF was also my first big library mainly done to learn. So I had to limit myself.

As a consequence, HPDF is only using the standard fonts defined in the PDF specification. It is not (yet) possible to include and use any other fonts.

So, for diagrams it is causing a problem : the face setting has nearly no meaning. Face is currently selected from the Italic and Oblique settings. Times is the default but when oblique is chosen, Helvetica is used.

I hope to improve this in future releases.

Here is a list of the fonts in HPDF:

  • Helvetica
  • Helvetica_Bold
  • Helvetica_Oblique
  • Helvetica_BoldOblique
  • Times_Roman
  • Times_Bold
  • Times_Italic
  • Times_BoldItalic
  • Courier
  • Courier_Bold
  • Courier_Oblique
  • Courier_BoldOblique
  • Symbol
  • ZapfDingbats