Search code examples
javascriptjqueryhtmlcanvasgojs

GOJS exporting the canvas diagram as an image


I am using the GOJS javascript framework to work with flowcharts. I have a pretty huge flowchart that isn't fully visible in the viewport. There is a scrollbar to view the hidden content in the canvas.

I am trying to export the canvas as an image. But I am only able to export the visible part in the canvas and not the full flowchart. I have tried using canvas.toDataURL() and the GOJS diagram.makeImageData() APIs, but haven't been successful.

Could the JS experts here please help me out? Thanks so much...


Solution

  • You should not be touching the Canvas element inside the Diagram's DIV element.

    Have you read http://gojs.net/latest/intro/makingImages.html ? You need to pass some options to Diagram.makeImageData.