问题描述
试图查看其他来源的内联PDF文件(即未下载),但它一直在下载。
router.route('/getFile')
.get(function (req,res,next){
let customerId = req.query.customerId;
let fileId = req.query.fileId;
let docLink = base_url + "/GetFile?customerId=" + customerId + "&fileId=" + fileId;
var filename = "document.pdf";
res.setHeader('Content-Type','application/pdf');
res.setHeader('Content-disposition','inline; filename=' + filename);
request.get({
url : docLink
},function(error,response,body){}).pipe(res,'binary');
});
Content-disposition内联似乎无法以这种方式工作。我猜想我应该在回调中有一些东西,但是尝试了一切之后却一无所知。需要有关如何进行操作的想法。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)