简体   繁体   English

如何使用nodejs将pdf数组缓冲区转换为pdf文件

[英]how to convert pdf array buffer to pdf file using nodejs

Following is the pdf buffer.以下是pdf缓冲区。 I want convert buffer to pdf file.我想将缓冲区转换为 pdf 文件。

data = {
    "file": {
        "type": "Buffer",
        "data": [
            102,
            24,
            62
        ]
    },
}
res.send( data );

You can use res.sendFile and use the header to send some data along.您可以使用res.sendFile并使用标头发送一些数据。

// res.sendFile(path [, options] [, fn])

let options = {
  headers: {
      'TheDataYouWantToSend': Date.now() // for example a timestamp
  }
}

req.sendFile(absolutePathToFile, options)

I hope this helps我希望这有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM