Export PNG with cytoscape function cy.png does not include popper.js labels

Viewed 548

I have tried to export the PNG related to the graph provided as sample for the integration of popper.js with cytoscape.js, but the exported png does not include the popper content when exported.

The reference sample is: https://cytoscape.org/cytoscape.js-popper/

The refence code to export the PNG is the following one:

                var text = window.cy.png({'output': 'blob'});
                var name = "test.png";
                var type = "image/png";
                var a = document.getElementById("downloadpng");
                var file = new Blob([text], { type: type });
                a.href = URL.createObjectURL(file);
                a.download = name;
                a.click();

This is the resulting image when exporting cy.png() included a popper.js content

1 Answers

I would say this is the expected behavior: image export in Cytoscape.js takes the Cytoscape.js canvas and exports it as image. The popper.js labels are not in the canvas - they are separate div objects in the DOM. Hence they are not included in the exported image.

Related