Search code examples
pdfcanvassvgjspdfjointjs

Jointjs diagram to pdf showing mouseover link svg also


I am exporting a diagram made using Jointjs library to pdf using jspdf and canvas: Below is my javascript code::

        var svg = document.querySelector('svg');

        var serializer = new XMLSerializer();
        var svgString = serializer.serializeToString(svg);
        var canvas = document.getElementById('canvas');
        var context = canvas.getContext('2d');

        context.fillStyle = '#FFFF';

        canvg(canvas, svgString);

        var imgData = canvas.toDataURL('image/png');

        // Generate PDF
        doc.setFontSize(10);
        doc.text(35, 25, "Google Cloud Craft");
        doc.addImage(imgData, 'PNG', 10, 50);
        doc.save('test.pdf');

the result i get after downloading and on canvas is:

enter image description here

What i want is those black arrow marks should not come as they are shown on mouseover events, it should be like below image for reference:

enter image description here

please let me know how can i achieve this.


Solution

  • I found a solution sharing, so that if anyone faces this issue can get help.

    this is the solution, who are familiar with jointjs will understand it.

    link.attr({
    
                '.marker-arrowheads': {
                    fill: 'none'
                },
                '.connection-wrap': {
                    fill: 'none'
                },
                '.marker-vertices': {
                    fill: 'none'
                },
                '.link-tools': {
                    fill: 'none'
                }
            });