diagrams-pdf-0.3: PDF backend for diagrams drawing EDSL

Safe HaskellNone

Diagrams.Backend.Pdf.CmdLine

Description

Convenient creation of command-line-driven executables for rendering diagrams using the Pdf backend.

  • defaultMain creates an executable which can render a single diagram at various options.

Synopsis

Documentation

defaultMain :: Diagram Pdf R2 -> IO ()Source

This is the simplest way to render diagrams, and is intended to be used like so:

 ... other definitions ...
 myDiagram = ...

 main = defaultMain myDiagram

Compiling a source file like the above example will result in an executable which takes command-line options for setting the size, output file, and so on, and renders myDiagram with the specified options.

Pass --help to the generated executable to see all available options. Currently it looks something like

 Command-line diagram generation.

Foo [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

For example, a couple common scenarios include

 $ ghc --make MyDiagram

# output image.eps with a width of 400pt (and auto-determined height)
 $ ./MyDiagram --compressed -o image.pdf -w 400

multipleMain :: [Diagram Pdf R2] -> IO ()Source

Generate a multipage PDF document from several diagrams. Each diagram is scaled to the page size

data Pdf Source

This data declaration is simply used as a token to distinguish this rendering engine.