Batwing10
Batwing10

Reputation: 21

How can I download Cytoscape.js graph as .pdf?

I am trying to download a Cytoscape graph generated by Cytoscape.js in Angular 12. I can download the given graph as .jpg, .png and .json. I would like to download it as .pdf

Code for downloading it as .png, .jpg and .json is something like this:

if(downloadAs == 'JSON'){
      var jsonBlob = new Blob([ JSON.stringify( this.cy.json() ) ], { type: 'application/javascript;charset=utf-8' });
      saveAs( jsonBlob, 'graph.json' );
    }
    else if(downloadAs == 'png'){
      saveAs(this.cy.png({bg: 'white'}), "graph.png");
    }
    else{
      saveAs(this.cy.jpg({bg: 'white'}), "graph.jpg");
    }

Upvotes: 2

Views: 68

Answers (0)

Related Questions