0.5.2 • Published 4 years ago

dmn-to-image v0.5.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

dmn-to-image

Based on nikku's BPMN to image

Convert DMN diagrams to PDF documents, SVG or PNG files.

Usage

This package exposes the dmn-to-image command line utility that allows you to convert DMN diagrams to PNG and PDF documents:

$ dmn-to-image --help

  Convert a DMN diagrams to PDF or PNG images

  Usage

    $ dmn-to-image <diagramFile>:<outputConfig> ...

  Options

    diagramFile                    Path to DMN diagram
    outputConfig                   List of extension or output file paths

    --min-dimensions=<dimensions>  Minimum size in pixels (<width>x<height>)

    --title=<title>                Add explicit <title> to exported image
    --no-title                     Don't display title on exported image

    --no-footer                    Strip title and logo from image

    --scale                        Scale factor for images (1)

  Examples

    # export to diagram.png
    $ dmn-to-image diagram.dmn:diagram.png

    # export diagram.png, diagram.svg and /tmp/diagram.pdf
    $ dmn-to-image diagram.dmn:diagram.png,diagram.svg,/tmp/diagram.pdf

    # export with minimum size of 500x300 pixels
    $ dmn-to-image --min-dimensions=500x300 diagram.dmn:png

Embedding

You may embed dmn-to-image and use it as parts of your application:

const {
  convertAll
} = require('dmn-to-image');

await convertAll([
  {
    input: 'diagram.dmn',
    outputs: [
      'diagram.pdf',
      'diagram.png',
      'diagram.svg'
    ]
  }
]);

This renders the DMN diagram using dmn-js and exports it to the specified output files using Puppeteer.

Install

npm install dmn-to-image

License

MIT