How to fit viewport DMNs

I am trying to convert bpmn-to-image to work with dmns instead of bpmns. Things seem to work as expected, but I am unable to fit the dmn to be the same size as the viewport. The result is much smaller than it should be. The image size itself seems to be correct though.

I am trying like this:

function resize() {
        const dmnViewer = getViewer();

        var canvas = dmnViewer.getActiveViewer().get('canvas');

        return new Promise(function(resolve, reject) {


          return resolve();

You can find the whole code here:

1 Like

I solved the issue by adding some CSS

 #canvas {
        position: relative;
        height: 100%;
        width: 100%;
        background-color: white;

      .dmn-js-parent {
        position: absolute !important;
      .dmn-drd-container {
        height: 100%;

dmn to image is now on npm

1 Like