Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The javascript mode of Processing utilizes HTML5 Canvas by default for rendering. You can use the HTML5 toDataURL method of canvas in order to export a PNG. </p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement</a></p> <p>In fact, that is what <a href="http://processingjs.org/reference/save_/" rel="nofollow noreferrer">save()</a> and <a href="http://processingjs.org/reference/saveFrame_/" rel="nofollow noreferrer">saveFrame()</a> do in Processing.js. If you look throug the reference in <a href="http://processingjs.org/reference/" rel="nofollow noreferrer">Processing.js</a> you'll notice that the functions you would use to export PDF in Processing are unavailable (indicated by red). </p> <p>Exporting to PDF from canvas does not seem possible. However, there are a few <a href="http://fabricjs.com/" rel="nofollow noreferrer">frameworks</a> that export canvas to SVG. It has been <a href="https://stackoverflow.com/questions/9648878/exporting-vector-graphics-from-html5-canvas">asked here before</a> as well. </p> <p><a href="http://coding.smashingmagazine.com/2012/02/22/web-drawing-throwdown-paper-processing-raphael/" rel="nofollow noreferrer">Here</a> is an extensive study for going from SVG to canvas and back again. Towards the bottom there is an excellent roundup of toolkits you can use. However, mixing these in with Processing.js is non-trivial. </p> <p>If you don't know Javascript well and you need to export to PDF or SVG in Javascript and not Java then I would suggest one of these other toolkits. Here is a <a href="http://coding.smashingmagazine.com/2012/02/22/web-drawing-throwdown-paper-processing-raphael/" rel="nofollow noreferrer">great page</a> that shows the basics of getting started on Processing.js vs Paper.js vs Raphael. You'll notice that is isn't too different, if you know Processing then you should be ok.</p> <p>Processing.js can also render to <a href="http://processingjs.org/articles/RenderingModes.html" rel="nofollow noreferrer">WebGL</a> but that doesn't have either an SVG or PDF export option natively or through any toolkit that I know of. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload