如何使用WebService显示或下载PDF文件的包含?
首先,我在WebServices和JavaScript上认识。
我正在尝试调用以这种格式返回PDF文件的Web服务:
为了调用PDF,我正在使用res.body,就像下面的代码:
var url="https://........../......./..../..";
var options = {
"rejectUnauthorized": false,
"method": "GET",
"url": url,
"headers": {
"Authorization": "Basic EJFHUygdiAISDGIF",
"Content-Type": "application/json"
}
};
request(options, (err, res) => {
if (res.statusCode == 200 ) {
conversation.logger().info("pdf:" + res.body); // in order to check the content of the pdf in the platform i use
}
});
我的问题是我没有知道如何下载或显示PDF内容。
任何帮助都是有价值的。
first of all i am quite knew at webservices and javascript.
I am trying to call a web service that returns a pdf file in this format :
In order to call the pdf i am using res.body just like the code below :
var url="https://........../......./..../..";
var options = {
"rejectUnauthorized": false,
"method": "GET",
"url": url,
"headers": {
"Authorization": "Basic EJFHUygdiAISDGIF",
"Content-Type": "application/json"
}
};
request(options, (err, res) => {
if (res.statusCode == 200 ) {
conversation.logger().info("pdf:" + res.body); // in order to check the content of the pdf in the platform i use
}
});
My problem here is that i dont know how to download or display the pdf content .
Any help would be valuable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将内容类型更改为PDF
Change content type to pdf