Convert SVG rects
to a single path string.
I needed to generate PDF documents for printing onto labels media. Some of the labels need barcodes, and I wanted everything to be vector, no bitmaps. I decided to use PDF Kit which can use SVG path strings to draw vector shapes. So I needed a way to generate an SVG barcode and get an SVG path string to feed to .path()
.
import srtps from './dist/srtps'
const svg = `<svg><rect width='4' height='28' x='33.000' y='0' /></svg>`
const path = srtps.rectsToPath(svg)
console.log('path =', path)
- Borrowed some maths from sstp