通过 node.js 使用 inkscape 将 PDF 转换为 SVG

convert PDF to SVG with inkscape via node.js

您好,我正在使用 inkscape 模块将 pdf 转换为 svg 以及为什么我得到 Cannot read property 'end' of undefined

我的代码:

const Inkscape = require('inkscape');

const pdfToSvgConverter = new Inkscape([
  '--export-plain-svg',
  '--import-pdf',
  '--export-text-to-path'
]);


fs.createReadStream('test/people.pdf').pipe(pdfToSvgConverter).pipe(fs.createWriteStream('./out.svg'));

如果您使用 Inkscape 1.0 或更高版本,可能是因为该模块尚不支持。他们完全改变了 CLI 开关。