How to fit viewport DMNs

Hi,
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) {
          canvas.resized();

          canvas.zoom('fit-viewport');

          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