I have an HTML/JavaScript program that uses the HTML5 canvas to generate a pretty graph:
I want to include this graph in a book that I'm producing with LaTeX. Unfortunately, when I print this page to PDF, I get a bitmap—presumably because canvas is a bitmap.
I just checked and apparently if I had developed this with SVG instead of with HTML5 canvas I would be good to go. But I didn't. So is there any way to generate line art from HTML5 Canvas, or should I just bite the bullet and re-implement this as SVG?
(I used canvas instead of svg because I thought that Canvas was preferred, more-modern, and more efficient. Was I mistaken?)
EDIT: Here is my JavaScript for drawing each arrow. I believe that I can readily port this to SVG using svg.js
/* Draw a Piece at its rotation at the position row,col */
drawRotatedPiece(p) {
let x = this.x(p.col);
let y = this.y(p.row);
this.ctx.beginPath();
this.ctx.save();
this.ctx.translate( x, y);
this.ctx.fillStyle='white';
this.ctx.fillRect( -this.radius, -this.radius, this.radius*2, this.radius*2 );
this.ctx.rotate( p.angle * Math.PI / 180);
this.ctx.moveTo( 0, -this.radius );
this.ctx.lineTo( -this.radius, 0 );
this.ctx.lineTo( +this.radius, 0 );
this.ctx.closePath( );
this.ctx.fillStyle='black';
this.ctx.fill();
this.ctx.fillRect( -this.radius/2.0, 0, this.radius, this.radius*2/3.0 );
this.ctx.restore();
}