title: How Can We Convert a JointJS Paper Model to a PDF?
body: <p>We are using <a href="https://www.jointjs.com/" rel="nofollow noreferrer">JointJS</a> in a React application, and we need to be able to render a PDF of the map that users can download. We can successfully get the map to display everything fine, but we cannot convert it to an SVG, which would then be build into a PDF.</p>
  <p>The way we understand how this should work:</p>
  <ul>
  <li>Convert the paper model to an SVG <a href="https://resources.jointjs.com/docs/rappid/v2.2/format.html#format.SVG" rel="nofollow noreferrer">using these Rappid instructions</a></li>
  <li>Build the rendered svg into the PDF</li>
  <li>Download the PDF</li>
  </ul>
  <p>The problem is that we can't read any of the data inside the paper model to actually render anything. When we try to follow <a href="https://resources.jointjs.com/docs/rappid/v2.2/format.html#format.SVG" rel="nofollow noreferrer">Rappid's .toSVG instructions</a>, it renders the SVG empty to where when it's console logged, all the colors are (0,0,0) and all the labeling is there but empty. Furthermore, many of the PDF and SVG conversion solutions we've tried render this model blank every time.</p>
  <p>The map itself renders fine on the page, but when we try to convert that component into an SVG or PDF, it also comes up as empty divs with JointJS-related classnames - indicating that the structure is there but the rendering data isn't making it through.</p>
  <p>Has anyone been able to come up with a solution for converting the Paper or Graph model into an SVG that can be used in a PDF? Because the solutions we've seen on Rappid don't seem to offer the full context for how they are supposed to be used.</p>
  <p>Below is the code we are the two functions we're trying from (<a href="https://resources.jointjs.com/docs/rappid/v2.2/format.html#format.SVG" rel="nofollow noreferrer">toSVG() and print()</a>) Rappid. The svg console logs with empty 0 data, and the print function opens the print menu and freezes.</p>
  <p>Thank you in advance for your help!</p>
  <pre><code>if (pdfDownload) {
          this.paper.toSVG((svgString) =&gt; {
              console.log(svgString);
              this.paper.print();
          });
      }
  </code></pre>