在Node.js中从html输出dynamicPDF

我想创build一个简单的端点,我将简单的css + html作为可见的pdf返回。 在Node.js中

像这样的东西:

response.headers('Content-Type', 'application/pdf'); let output = '<h1>some html</h1>' let bufferData = Buffer.from(output, 'utf8'); response.body = bufferData